# Changelog


## [2.0.0] - 2026-09-11

### Breaking Changes

- `Quat` is now immutable, matching `Vector` and `Matrix`: `add()`, `multiply()`, `normalize()`, `inverse()`, `conjugate()` and `calculateW()` now return a new `Quat` instead of mutating the receiver and returning `this`. The per-component setters (`x`, `y`, `z`, `w`, `xy`, `xyz`, `xyzw`) have been removed; only the bulk `values` setter remains. `copy()` no longer accepts a `dest` argument - it always returns a new instance.
- Renamed `Vector.addAValue()` to `addValues(count = 1)`, `Vector.angleFrom()` to `angle()`, `Vector.distanceFrom()` to `distance()`, and `Vector.get360angle()` to `signedAngle()`.
- Renamed `Matrix.addAColumn()` and `Matrix.addARow()` to `addColumns(count = 1)` and `addRows(count = 1)`, respectively. Both methods now support adding multiple dimensions and reject invalid counts.
- Renamed `Matrix.setAsIdentity()` to `setIdentity()` and `Matrix.getCofactor()` to `cofactor()`.

### Added

- `Matrix#add()`, `Matrix#subtract()` and `Matrix#scale()`.
- `Matrix#trace()`.
- `Matrix.fromArray(values, rows, columns)`, to build a matrix from a flat, row-major array.
- `Vector#copy()` and `Matrix#copy()`.
- An optional `threshold` parameter on `Vector#equals()` and `Matrix#equals()` (default: `0`, i.e. exact equality), matching the one `Quat#equals()` already had.
- `EPSILON` is now re-exported from the package root.
- A GitHub Actions CI workflow: lint, test, build, and package-correctness checks (`arethetypeswrong`, `publint`) on Node 20 and 22.

### Fixed

- Fixed a packaging bug: a stale, incorrectly-cased `lib/quat.d.ts` (left over from a source file rename) was shipping alongside the correct `lib/Quat.d.ts`, breaking module resolution on case-sensitive filesystems (Linux, most CI, and most installs outside macOS/Windows).
- Fixed `Quat.cross()`, which silently computed the wrong values - a cyclically shuffled copy of the Hamilton product formula - instead of an actual cross product.
- Fixed `Quat.shortMix()` producing non-unit, geometrically incorrect quaternions when interpolating between two rotations more than 180° apart.
- Fixed `Vector#normalize()` returning `[NaN, NaN, ...]` for a zero-length vector; it now returns a zero vector.
- Fixed `Matrix`'s `values` setter throwing when assigned an empty array.
- Fixed `Vector#addAValue()` mutating the receiver in addition to returning a new instance.
- Fixed `npm run lint`, which had been broken since the ESLint 9 upgrade (ESLint 9+ requires flat config; the project still had a `.eslintrc.js`).

### Changed

- Replaced `Matrix#determinant()`'s and `Matrix#inverse()`'s O(n!) cofactor-expansion algorithms with O(n^3) LU decomposition / Gauss-Jordan elimination (with partial pivoting). A 20x20 determinant now completes in under 1ms; the previous implementation could no longer complete in reasonable time past roughly 10x10.
- Upgraded `eslint` (9 → 10, migrated to flat config), `vitest` / `@vitest/coverage-v8` (3 → 5), `vite` (7 → 8), and `@typescript-eslint/*` (8.59 → 8.70).
- Modernized `tsconfig.json`: `target` ES5 → ES2020, `moduleResolution` `node` → `bundler`, explicit `rootDir`, and `declarationMap` instead of a no-op `sourceMap`.
- Added `license`, `repository`, `keywords`, `type` and `engines` fields to `package.json`.
- Fixed README drift (several documented methods/signatures no longer matched the code) and documented `Quat` for the first time.
