diff --git a/docs/upgrade-guide.md b/docs/upgrade-guide.md index aab2e6de..1d2ad143 100644 --- a/docs/upgrade-guide.md +++ b/docs/upgrade-guide.md @@ -2,7 +2,11 @@ ## Upgrading to v3.0 -#### `Matrix` transforms now return `Array` by default +#### Matrix API changes + +* Matrix setter functions no longer support ommitted parameters. (Motivation: Increased API rigor, improved debugging and library compactness). + +#### `Matrix` transforms now return `Array`s by default The `Matrix4` and `Matrix3` classes no longer by default create new `Vector2`, `Vector3` and `Vector4` instances. Instead they create standard JavaScript arrays. @@ -29,14 +33,12 @@ assert(vector instanceof Vector4); Motivation: This change reduces dependencies between math.gl core classes which improves tree-shaking and bundle sizes. -### Matrix setter functions no longer support ommitted parameters - -Motivation: This change increases rigor, facilitates debugging, and improves library compactness, and the use case for default parameters was questionable. #### Deprecations | Method | Replacement | Reason | | --- | --- | --- | +| `Matrix*.setColumnMajor` | `Matrix*.set` | API simplification | | `Matrix4.transformPoint` | `Matrix4.transform` | Name alignment | | `Matrix4.transformVector` | `Matrix4.transform` | Name alignment | | `Matrix4.transformDirection` | `Matrix4.transformAsVector` | Name alignment | diff --git a/modules/core/src/classes/base/matrix.js b/modules/core/src/classes/base/matrix.js index ff6ad32b..7cdfe88e 100644 --- a/modules/core/src/classes/base/matrix.js +++ b/modules/core/src/classes/base/matrix.js @@ -1,5 +1,5 @@ import MathArray from './math-array'; -import {checkNumber} from '../../lib/validators'; +import {checkNumber, deprecated} from '../../lib/validators'; import {config} from '../../lib/common'; export default class Matrix extends MathArray { @@ -37,17 +37,6 @@ export default class Matrix extends MathArray { return this.copy(arguments); } - // accepts row major order, stores as column major - setTransposed() { - const {RANK} = this; - for (let row = 0; row < RANK; row++) { - for (let col = 0; col < RANK; col++) { - this[row * RANK + col] = arguments[col * RANK + row]; - } - } - return this.check(); - } - toColumnMajor(result) { return this.toArray(result); } @@ -88,4 +77,9 @@ export default class Matrix extends MathArray { multiplyMatrices(a, b) { return this.copy(a).multiplyRight(b); } + + setColumnMajor() { + deprecated('Matrix.setColumnMajor', '3.0'); + return this.set(arguments); + } }