linearly 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/lib/cjs/demo.d.ts +2 -0
- package/lib/cjs/demo.d.ts.map +1 -0
- package/lib/cjs/demo.js +7 -0
- package/lib/cjs/index.d.ts +9 -45
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +19 -61
- package/lib/cjs/mat2.d.ts +133 -128
- package/lib/cjs/mat2.d.ts.map +1 -1
- package/lib/cjs/mat2.js +257 -246
- package/lib/cjs/mat2d.d.ts +160 -154
- package/lib/cjs/mat2d.d.ts.map +1 -1
- package/lib/cjs/mat2d.js +425 -418
- package/lib/cjs/mat3.d.ts +172 -167
- package/lib/cjs/mat3.d.ts.map +1 -1
- package/lib/cjs/mat3.js +512 -506
- package/lib/cjs/mat4.d.ts +391 -372
- package/lib/cjs/mat4.d.ts.map +1 -1
- package/lib/cjs/mat4.js +1338 -1336
- package/lib/cjs/quat.d.ts +239 -234
- package/lib/cjs/quat.d.ts.map +1 -1
- package/lib/cjs/quat.js +494 -490
- package/lib/cjs/scalar.d.ts +204 -199
- package/lib/cjs/scalar.d.ts.map +1 -1
- package/lib/cjs/scalar.js +323 -317
- package/lib/cjs/vec2.d.ts +307 -302
- package/lib/cjs/vec2.d.ts.map +1 -1
- package/lib/cjs/vec2.js +612 -604
- package/lib/cjs/vec3.d.ts +359 -354
- package/lib/cjs/vec3.d.ts.map +1 -1
- package/lib/cjs/vec3.js +760 -755
- package/lib/cjs/vec4.d.ts +301 -296
- package/lib/cjs/vec4.d.ts.map +1 -1
- package/lib/cjs/vec4.js +691 -681
- package/lib/esm/demo.d.ts +2 -0
- package/lib/esm/demo.d.ts.map +1 -0
- package/lib/esm/demo.js +5 -0
- package/lib/esm/index.d.ts +9 -45
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +10 -38
- package/lib/esm/mat2.d.ts +133 -128
- package/lib/esm/mat2.d.ts.map +1 -1
- package/lib/esm/mat2.js +260 -230
- package/lib/esm/mat2d.d.ts +160 -154
- package/lib/esm/mat2d.d.ts.map +1 -1
- package/lib/esm/mat2d.js +424 -393
- package/lib/esm/mat3.d.ts +172 -167
- package/lib/esm/mat3.d.ts.map +1 -1
- package/lib/esm/mat3.js +511 -479
- package/lib/esm/mat4.d.ts +391 -372
- package/lib/esm/mat4.d.ts.map +1 -1
- package/lib/esm/mat4.js +1337 -1290
- package/lib/esm/quat.d.ts +239 -234
- package/lib/esm/quat.d.ts.map +1 -1
- package/lib/esm/quat.js +493 -468
- package/lib/esm/scalar.d.ts +204 -199
- package/lib/esm/scalar.d.ts.map +1 -1
- package/lib/esm/scalar.js +317 -279
- package/lib/esm/vec2.d.ts +307 -302
- package/lib/esm/vec2.d.ts.map +1 -1
- package/lib/esm/vec2.js +611 -543
- package/lib/esm/vec3.d.ts +359 -354
- package/lib/esm/vec3.d.ts.map +1 -1
- package/lib/esm/vec3.js +759 -692
- package/lib/esm/vec4.d.ts +301 -296
- package/lib/esm/vec4.d.ts.map +1 -1
- package/lib/esm/vec4.js +690 -626
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,14 +26,14 @@ vec2.scale(out, out, 3)
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
// In linearly, you can simply write like this:
|
|
29
|
-
import {mat2d,
|
|
29
|
+
import {mat2d, vec3} from 'linearly'
|
|
30
30
|
|
|
31
31
|
const dir = vec3.normalize([2, 1, 3])
|
|
32
32
|
let out = vec3.cross(dir, [0, 1, 0])
|
|
33
33
|
out = vec3.scale(out, 3)
|
|
34
34
|
|
|
35
35
|
// As the values of Linearly are plain 1D arrays, you can initialize a vector by either way.
|
|
36
|
-
const a:
|
|
36
|
+
const a: vec2 = [1, 2]
|
|
37
37
|
const b = vec2.of(1, 2)
|
|
38
38
|
|
|
39
39
|
// But since vector and matrix are immutable and annotated with readonly flags, a mutation such as below are handled as an error in TypeScript.
|
|
@@ -42,7 +42,7 @@ a[0] = 3
|
|
|
42
42
|
// Cannot assign to '0' because it is a read-only property.
|
|
43
43
|
|
|
44
44
|
// Some constants such as mat2.identity are also readonly and defined as frozen array (applied Object.freeze). You can use `clone` to mutate them.
|
|
45
|
-
const m
|
|
45
|
+
const m = mat2d.clone(mat2d.ident)
|
|
46
46
|
m[4] *= 2.0
|
|
47
47
|
m[5] = -4.5
|
|
48
48
|
```
|
|
@@ -58,10 +58,10 @@ In addition to functions that can be found on [glMatrix docs](https://glmatrix.n
|
|
|
58
58
|
The names of modules are derived from glMatrix.
|
|
59
59
|
|
|
60
60
|
- `scalar`: A single number
|
|
61
|
-
- `mat2`: 2D linear transformation (rotation
|
|
62
|
-
- `mat2d`: 2D affine transformation, omitting redundant third rows, which is always set to `[0, 0, 1]` (translation
|
|
63
|
-
- `mat3`: 2D
|
|
64
|
-
- `mat4`: 3D
|
|
61
|
+
- `mat2`: 2D linear transformation (rotation, scaling, skewing)
|
|
62
|
+
- `mat2d`: 2D affine transformation, omitting redundant third rows, which is always set to `[0, 0, 1]` (translation, rotation, scaling, skewing)
|
|
63
|
+
- `mat3`: 2D affine transformation (translation, rotation, scaling, skewing)
|
|
64
|
+
- `mat4`: 3D transformation
|
|
65
65
|
- `quat`: 3D rotation
|
|
66
66
|
|
|
67
67
|
See the [Full API documentation](https://baku89.github.io/linearly) for further information.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":""}
|
package/lib/cjs/demo.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
const x = _1.vec2.add([1, 2], [3, 4]);
|
|
5
|
+
const y = _1.vec2.clone(x);
|
|
6
|
+
y[0] = 3;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVtby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZW1vLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsd0JBQXNCO0FBRXRCLE1BQU0sQ0FBQyxHQUFTLE9BQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQTtBQUV4QyxNQUFNLENBQUMsR0FBRyxPQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBRXZCLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUEifQ==
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* Represents 3D vector.
|
|
12
|
-
*/
|
|
13
|
-
export * as vec3 from './vec3';
|
|
14
|
-
export type { Vec3 } from './vec3';
|
|
15
|
-
/**
|
|
16
|
-
* Represents 4D vector.
|
|
17
|
-
*/
|
|
18
|
-
export * as vec4 from './vec4';
|
|
19
|
-
export type { Vec4 } from './vec4';
|
|
20
|
-
/**
|
|
21
|
-
* Represents 2D linear transformation (rotation, scaling, skewing).
|
|
22
|
-
*/
|
|
23
|
-
export * as mat2 from './mat2';
|
|
24
|
-
export type { Mat2 } from './mat2';
|
|
25
|
-
/**
|
|
26
|
-
* Represents 2D affine transformation (translation, rotation, scaling, skewing), omitting reduction thrid row which is always set to `[0, 0, 1]`. The order of six elements is the same as CSS transform matrix.
|
|
27
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix
|
|
28
|
-
*/
|
|
29
|
-
export * as mat2d from './mat2d';
|
|
30
|
-
export type { Mat2d } from './mat2d';
|
|
31
|
-
/**
|
|
32
|
-
* Rpresents 2D homogeneous transformation (translation, rotation, scaling, skewing, perspective).
|
|
33
|
-
*/
|
|
34
|
-
export * as mat3 from './mat3';
|
|
35
|
-
export type { Mat3 } from './mat3';
|
|
36
|
-
/**
|
|
37
|
-
* Represents 3D affine transformation (translation, rotation, scaling, skewing).
|
|
38
|
-
*/
|
|
39
|
-
export * as mat4 from './mat4';
|
|
40
|
-
export type { Mat4 } from './mat4';
|
|
41
|
-
/**
|
|
42
|
-
* Represents rotation in 3D space.
|
|
43
|
-
*/
|
|
44
|
-
export * as quat from './quat';
|
|
45
|
-
export type { Quat } from './quat';
|
|
1
|
+
export { scalar } from './scalar';
|
|
2
|
+
export { vec2 } from './vec2';
|
|
3
|
+
export { vec3 } from './vec3';
|
|
4
|
+
export { vec4 } from './vec4';
|
|
5
|
+
export { mat2 } from './mat2';
|
|
6
|
+
export { mat2d } from './mat2d';
|
|
7
|
+
export { mat3 } from './mat3';
|
|
8
|
+
export { mat4 } from './mat4';
|
|
9
|
+
export { quat } from './quat';
|
|
46
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,64 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.quat = exports.mat4 = exports.mat3 = exports.mat2d = exports.mat2 = exports.vec4 = exports.vec3 = exports.vec2 = exports.scalar = void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exports
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
exports
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
exports.mat2 = __importStar(require("./mat2"));
|
|
47
|
-
/**
|
|
48
|
-
* Represents 2D affine transformation (translation, rotation, scaling, skewing), omitting reduction thrid row which is always set to `[0, 0, 1]`. The order of six elements is the same as CSS transform matrix.
|
|
49
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix
|
|
50
|
-
*/
|
|
51
|
-
exports.mat2d = __importStar(require("./mat2d"));
|
|
52
|
-
/**
|
|
53
|
-
* Rpresents 2D homogeneous transformation (translation, rotation, scaling, skewing, perspective).
|
|
54
|
-
*/
|
|
55
|
-
exports.mat3 = __importStar(require("./mat3"));
|
|
56
|
-
/**
|
|
57
|
-
* Represents 3D affine transformation (translation, rotation, scaling, skewing).
|
|
58
|
-
*/
|
|
59
|
-
exports.mat4 = __importStar(require("./mat4"));
|
|
60
|
-
/**
|
|
61
|
-
* Represents rotation in 3D space.
|
|
62
|
-
*/
|
|
63
|
-
exports.quat = __importStar(require("./quat"));
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7R0FFRztBQUNILG1EQUFrQztBQUVsQzs7R0FFRztBQUNILCtDQUE4QjtBQUc5Qjs7R0FFRztBQUNILCtDQUE4QjtBQUc5Qjs7R0FFRztBQUNILCtDQUE4QjtBQUc5Qjs7R0FFRztBQUNILCtDQUE4QjtBQUc5Qjs7O0dBR0c7QUFDSCxpREFBZ0M7QUFHaEM7O0dBRUc7QUFDSCwrQ0FBOEI7QUFHOUI7O0dBRUc7QUFDSCwrQ0FBOEI7QUFHOUI7O0dBRUc7QUFDSCwrQ0FBOEIifQ==
|
|
4
|
+
var scalar_1 = require("./scalar");
|
|
5
|
+
Object.defineProperty(exports, "scalar", { enumerable: true, get: function () { return scalar_1.scalar; } });
|
|
6
|
+
var vec2_1 = require("./vec2");
|
|
7
|
+
Object.defineProperty(exports, "vec2", { enumerable: true, get: function () { return vec2_1.vec2; } });
|
|
8
|
+
var vec3_1 = require("./vec3");
|
|
9
|
+
Object.defineProperty(exports, "vec3", { enumerable: true, get: function () { return vec3_1.vec3; } });
|
|
10
|
+
var vec4_1 = require("./vec4");
|
|
11
|
+
Object.defineProperty(exports, "vec4", { enumerable: true, get: function () { return vec4_1.vec4; } });
|
|
12
|
+
var mat2_1 = require("./mat2");
|
|
13
|
+
Object.defineProperty(exports, "mat2", { enumerable: true, get: function () { return mat2_1.mat2; } });
|
|
14
|
+
var mat2d_1 = require("./mat2d");
|
|
15
|
+
Object.defineProperty(exports, "mat2d", { enumerable: true, get: function () { return mat2d_1.mat2d; } });
|
|
16
|
+
var mat3_1 = require("./mat3");
|
|
17
|
+
Object.defineProperty(exports, "mat3", { enumerable: true, get: function () { return mat3_1.mat3; } });
|
|
18
|
+
var mat4_1 = require("./mat4");
|
|
19
|
+
Object.defineProperty(exports, "mat4", { enumerable: true, get: function () { return mat4_1.mat4; } });
|
|
20
|
+
var quat_1 = require("./quat");
|
|
21
|
+
Object.defineProperty(exports, "quat", { enumerable: true, get: function () { return quat_1.quat; } });
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQStCO0FBQXZCLGdHQUFBLE1BQU0sT0FBQTtBQUVkLCtCQUEyQjtBQUFuQiw0RkFBQSxJQUFJLE9BQUE7QUFFWiwrQkFBMkI7QUFBbkIsNEZBQUEsSUFBSSxPQUFBO0FBRVosK0JBQTJCO0FBQW5CLDRGQUFBLElBQUksT0FBQTtBQUVaLCtCQUEyQjtBQUFuQiw0RkFBQSxJQUFJLE9BQUE7QUFFWixpQ0FBNkI7QUFBckIsOEZBQUEsS0FBSyxPQUFBO0FBRWIsK0JBQTJCO0FBQW5CLDRGQUFBLElBQUksT0FBQTtBQUVaLCtCQUEyQjtBQUFuQiw0RkFBQSxJQUFJLE9BQUE7QUFFWiwrQkFBMkI7QUFBbkIsNEZBQUEsSUFBSSxPQUFBIn0=
|
package/lib/cjs/mat2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vec2 } from './vec2';
|
|
2
2
|
/**
|
|
3
3
|
* Represents 2D transformation exclude translation.
|
|
4
4
|
* The format is column-major as in WebGL, so the matrix looks like this:
|
|
@@ -8,131 +8,136 @@ import { Vec2 } from './vec2';
|
|
|
8
8
|
* ```
|
|
9
9
|
* @category Types
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
11
|
+
export type mat2 = readonly [m00: number, m01: number, m10: number, m11: number];
|
|
12
|
+
/**
|
|
13
|
+
* Functions for {@link mat2}, 2D transformation matrix exclude translation.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace mat2 {
|
|
16
|
+
/**
|
|
17
|
+
* Mutable version of {@link mat2}
|
|
18
|
+
* @category Types
|
|
19
|
+
*/
|
|
20
|
+
type Mutable = [m00: number, m01: number, m10: number, m11: number];
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new matrix from given elements
|
|
23
|
+
* @category Generators
|
|
24
|
+
*/
|
|
25
|
+
function of(m00: number, m01: number, m10: number, m11: number): mat2;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a mutable clone of given mat2
|
|
28
|
+
* @category Generators
|
|
29
|
+
*/
|
|
30
|
+
function clone(a: mat2): Mutable;
|
|
31
|
+
/**
|
|
32
|
+
* The identity matrix of mat2.
|
|
33
|
+
* ```
|
|
34
|
+
* [1, 0,
|
|
35
|
+
* 0, 1]
|
|
36
|
+
* ```
|
|
37
|
+
* @category Constants
|
|
38
|
+
*/
|
|
39
|
+
const identity: mat2;
|
|
40
|
+
/**
|
|
41
|
+
* The mat2d filled with zeros.
|
|
42
|
+
* @category Constants
|
|
43
|
+
*/
|
|
44
|
+
const zero: mat2;
|
|
45
|
+
/**
|
|
46
|
+
* Transpose the values of a mat2
|
|
47
|
+
*/
|
|
48
|
+
function transpose(a: mat2): mat2;
|
|
49
|
+
/**
|
|
50
|
+
* Inverts a mat2
|
|
51
|
+
*/
|
|
52
|
+
function invert(a: mat2): mat2 | null;
|
|
53
|
+
/**
|
|
54
|
+
* Calculates the adjugate of a mat2
|
|
55
|
+
*/
|
|
56
|
+
function adjoint(a: mat2): mat2;
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the determinant of a mat2
|
|
59
|
+
* @returns determinant of a
|
|
60
|
+
*/
|
|
61
|
+
function determinant(a: mat2): number;
|
|
62
|
+
/**
|
|
63
|
+
* Multiplies given mat2's
|
|
64
|
+
*/
|
|
65
|
+
function multiply(...ms: mat2[]): mat2;
|
|
66
|
+
/**
|
|
67
|
+
* Rotates a mat2 by the given angle
|
|
68
|
+
*
|
|
69
|
+
* @param a the matrix to rotate
|
|
70
|
+
* @param rad the angle to rotate the matrix by
|
|
71
|
+
*/
|
|
72
|
+
function rotate(a: mat2, rad: number): mat2;
|
|
73
|
+
/**
|
|
74
|
+
* Scales the mat2 by the dimensions in the given vec2
|
|
75
|
+
**/
|
|
76
|
+
function scale(a: mat2, b: vec2 | number): mat2;
|
|
77
|
+
/**
|
|
78
|
+
* Apply skew to the mat2d by the given angles
|
|
79
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew
|
|
80
|
+
*/
|
|
81
|
+
function skew(m: mat2, rad: vec2): mat2;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a matrix from a given angle
|
|
84
|
+
* @category Generators
|
|
85
|
+
*/
|
|
86
|
+
function fromRotation(rad: number): mat2;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a matrix from a vector scaling
|
|
89
|
+
* @category Generators
|
|
90
|
+
*/
|
|
91
|
+
function fromScaling(v: vec2): mat2;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a matrix from a vector skew
|
|
94
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew
|
|
95
|
+
* @category Generators
|
|
96
|
+
*/
|
|
97
|
+
function fromSkew(rad: vec2): mat2;
|
|
98
|
+
/**
|
|
99
|
+
* Returns Frobenius norm of a mat2
|
|
100
|
+
*/
|
|
101
|
+
function frob(a: mat2): number;
|
|
102
|
+
/**
|
|
103
|
+
* Adds given mat2's
|
|
104
|
+
*/
|
|
105
|
+
function add(...ms: mat2[]): mat2;
|
|
106
|
+
/**
|
|
107
|
+
* Subtracts matrix b from matrix a
|
|
108
|
+
*/
|
|
109
|
+
function subtract(...ms: mat2[]): mat2;
|
|
110
|
+
/**
|
|
111
|
+
* Subtracts b from a
|
|
112
|
+
*/
|
|
113
|
+
function delta(a: mat2, b: mat2): mat2;
|
|
114
|
+
/**
|
|
115
|
+
* Returns whether or not the matrices have exactly the same elements in the same position (when compared with `===`)
|
|
116
|
+
*/
|
|
117
|
+
function exactEquals(a: mat2, b: mat2): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Returns whether or not the matrices have approximately the same elements in the same position.
|
|
120
|
+
*/
|
|
121
|
+
function equals(a: mat2, b: mat2): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Alias for {@link identity}
|
|
124
|
+
* @category Aliases
|
|
125
|
+
*/
|
|
126
|
+
const ident: mat2;
|
|
127
|
+
/**
|
|
128
|
+
* Alias for {@link subtract}
|
|
129
|
+
* @category Aliases
|
|
130
|
+
*/
|
|
131
|
+
const sub: typeof subtract;
|
|
132
|
+
/**
|
|
133
|
+
* Alias for {@link mat2.multiply}
|
|
134
|
+
* @category Aliases
|
|
135
|
+
*/
|
|
136
|
+
const mul: typeof multiply;
|
|
137
|
+
/**
|
|
138
|
+
* Alias for {@link mat2.determinant}
|
|
139
|
+
* @category Aliases
|
|
140
|
+
*/
|
|
141
|
+
const det: typeof determinant;
|
|
142
|
+
}
|
|
138
143
|
//# sourceMappingURL=mat2.d.ts.map
|
package/lib/cjs/mat2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mat2.d.ts","sourceRoot":"","sources":["../../src/mat2.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"mat2.d.ts","sourceRoot":"","sources":["../../src/mat2.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM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