@vived/app 2.20.0 → 2.21.1
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/lib/Entities/KeyboardInput.js +0 -2
- package/lib/Entities/MouseInput.js +0 -5
- package/lib/Entities/SceneRoot.d.ts +69 -0
- package/lib/Entities/SceneRoot.js +77 -0
- package/lib/Entities/TransformNode.d.ts +78 -0
- package/lib/Entities/TransformNode.js +217 -0
- package/lib/Entities/WorkPlane.d.ts +69 -0
- package/lib/Entities/WorkPlane.js +122 -0
- package/lib/Entities/index.d.ts +3 -0
- package/lib/Entities/index.js +3 -0
- package/lib/PresentationManagers/TransformNodePM.d.ts +14 -0
- package/lib/PresentationManagers/TransformNodePM.js +23 -0
- package/lib/PresentationManagers/index.d.ts +1 -0
- package/lib/PresentationManagers/index.js +1 -0
- package/lib/UseCases/SceneRoot/SerializeSceneRoot.d.ts +18 -0
- package/lib/UseCases/SceneRoot/SerializeSceneRoot.js +48 -0
- package/lib/UseCases/SceneRoot/index.d.ts +1 -0
- package/lib/UseCases/SceneRoot/index.js +13 -0
- package/lib/UseCases/index.d.ts +1 -0
- package/lib/UseCases/index.js +1 -0
- package/lib/ValueObjects/Angle.d.ts +18 -0
- package/lib/ValueObjects/Angle.js +26 -2
- package/lib/ValueObjects/Color.d.ts +46 -0
- package/lib/ValueObjects/Color.js +46 -0
- package/lib/ValueObjects/Matrix.d.ts +120 -0
- package/lib/ValueObjects/Matrix.js +423 -0
- package/lib/ValueObjects/Quaternion.d.ts +94 -0
- package/lib/ValueObjects/Quaternion.js +243 -0
- package/lib/ValueObjects/Vector2.d.ts +82 -0
- package/lib/ValueObjects/Vector2.js +82 -0
- package/lib/ValueObjects/Vector3.d.ts +107 -0
- package/lib/ValueObjects/Vector3.js +116 -0
- package/lib/ValueObjects/index.d.ts +2 -0
- package/lib/ValueObjects/index.js +2 -0
- package/package.json +1 -1
package/lib/Entities/index.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export * from "./MemoizedVector3";
|
|
|
10
10
|
export * from "./ObserverList";
|
|
11
11
|
export * from "./FocusCamera";
|
|
12
12
|
export * from "./StateMachine";
|
|
13
|
+
export * from "./TransformNode";
|
|
13
14
|
export * from "./UndoRedo";
|
|
14
15
|
export * from "./MouseInput";
|
|
15
16
|
export * from "./TouchInput";
|
|
16
17
|
export * from "./QuestionChallengeAnswer";
|
|
17
18
|
export * from "./QuestionChallenge";
|
|
19
|
+
export * from "./SceneRoot";
|
|
20
|
+
export * from "./WorkPlane";
|
package/lib/Entities/index.js
CHANGED
|
@@ -22,8 +22,11 @@ __exportStar(require("./MemoizedVector3"), exports);
|
|
|
22
22
|
__exportStar(require("./ObserverList"), exports);
|
|
23
23
|
__exportStar(require("./FocusCamera"), exports);
|
|
24
24
|
__exportStar(require("./StateMachine"), exports);
|
|
25
|
+
__exportStar(require("./TransformNode"), exports);
|
|
25
26
|
__exportStar(require("./UndoRedo"), exports);
|
|
26
27
|
__exportStar(require("./MouseInput"), exports);
|
|
27
28
|
__exportStar(require("./TouchInput"), exports);
|
|
28
29
|
__exportStar(require("./QuestionChallengeAnswer"), exports);
|
|
29
30
|
__exportStar(require("./QuestionChallenge"), exports);
|
|
31
|
+
__exportStar(require("./SceneRoot"), exports);
|
|
32
|
+
__exportStar(require("./WorkPlane"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TransformNode } from "../Entities";
|
|
2
|
+
import { Quaternion, Vector3 } from "../ValueObjects";
|
|
3
|
+
export interface TransformNodeVM {
|
|
4
|
+
position: Vector3;
|
|
5
|
+
rotation: Quaternion;
|
|
6
|
+
scale: Vector3;
|
|
7
|
+
}
|
|
8
|
+
export declare class TransformNodePM {
|
|
9
|
+
private transformNode;
|
|
10
|
+
private updateView;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
doUpdateView: () => void;
|
|
13
|
+
constructor(transformNode: TransformNode, updateView: (vm: TransformNodeVM) => void);
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransformNodePM = void 0;
|
|
4
|
+
class TransformNodePM {
|
|
5
|
+
constructor(transformNode, updateView) {
|
|
6
|
+
this.transformNode = transformNode;
|
|
7
|
+
this.updateView = updateView;
|
|
8
|
+
this.dispose = () => {
|
|
9
|
+
this.transformNode.removeObserver(this.doUpdateView);
|
|
10
|
+
};
|
|
11
|
+
this.doUpdateView = () => {
|
|
12
|
+
const vm = {
|
|
13
|
+
position: this.transformNode.localPosition,
|
|
14
|
+
rotation: this.transformNode.localRotation,
|
|
15
|
+
scale: this.transformNode.localScale,
|
|
16
|
+
};
|
|
17
|
+
this.updateView(vm);
|
|
18
|
+
};
|
|
19
|
+
transformNode.addObserver(this.doUpdateView);
|
|
20
|
+
this.doUpdateView();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TransformNodePM = TransformNodePM;
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./HasUndoPM"), exports);
|
|
|
18
18
|
__exportStar(require("./FocusCameraPM"), exports);
|
|
19
19
|
__exportStar(require("./QuestionChallenge"), exports);
|
|
20
20
|
__exportStar(require("./FocusCameraPosRotPM"), exports);
|
|
21
|
+
__exportStar(require("./TransformNodePM"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SerializedSystem, StateMachine } from "../../Entities";
|
|
2
|
+
import { SceneRoot } from "../../Entities/SceneRoot";
|
|
3
|
+
export declare class SerializeSceneRoot implements SerializedSystem {
|
|
4
|
+
name: string;
|
|
5
|
+
seriliziationVersion: number;
|
|
6
|
+
private sceneRoot;
|
|
7
|
+
private stateMachine;
|
|
8
|
+
getSystemState(): object;
|
|
9
|
+
applySystemState(serializedState: object, version: number, transitionTime: number): void;
|
|
10
|
+
applyDefaultState(transitionDuration: number): void;
|
|
11
|
+
private applyV1Data;
|
|
12
|
+
constructor(sceneRoot: SceneRoot, stateMachine: StateMachine);
|
|
13
|
+
}
|
|
14
|
+
export interface SceneRootDataV1 {
|
|
15
|
+
position: [number, number, number];
|
|
16
|
+
rotation: [number, number, number, number];
|
|
17
|
+
scale: [number, number, number];
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SerializeSceneRoot = void 0;
|
|
4
|
+
const ValueObjects_1 = require("../../ValueObjects");
|
|
5
|
+
class SerializeSceneRoot {
|
|
6
|
+
constructor(sceneRoot, stateMachine) {
|
|
7
|
+
this.name = "sceneRoot";
|
|
8
|
+
this.seriliziationVersion = 1;
|
|
9
|
+
this.sceneRoot = sceneRoot;
|
|
10
|
+
this.stateMachine = stateMachine;
|
|
11
|
+
stateMachine.registerSerializedSystem(this);
|
|
12
|
+
}
|
|
13
|
+
getSystemState() {
|
|
14
|
+
const rootTransform = this.sceneRoot.transform;
|
|
15
|
+
const data = {
|
|
16
|
+
position: rootTransform.localPosition.array,
|
|
17
|
+
rotation: rootTransform.localRotation.toArray(),
|
|
18
|
+
scale: rootTransform.localScale.array,
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
applySystemState(serializedState, version, transitionTime) {
|
|
23
|
+
try {
|
|
24
|
+
if (version === 1) {
|
|
25
|
+
const castState = serializedState;
|
|
26
|
+
this.applyV1Data(castState, transitionTime);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.warn(`[SerializeSceneRoot] Unsupported version number ${version}. Defaulting`);
|
|
30
|
+
this.applyDefaultState(transitionTime);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
console.warn(`[SerializeSceneRoot] Caught when deserializing ${e}. Defaulting`);
|
|
35
|
+
this.applyDefaultState(transitionTime);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
applyDefaultState(transitionDuration) {
|
|
39
|
+
this.sceneRoot.transform.lerp(transitionDuration * 1000, this.stateMachine.transitionEaseFunction, this.sceneRoot.defaultPosition, this.sceneRoot.defaultRoation, this.sceneRoot.defaultScale);
|
|
40
|
+
}
|
|
41
|
+
applyV1Data(data, transitionTime) {
|
|
42
|
+
const pos = ValueObjects_1.Vector3.FromArray(data.position);
|
|
43
|
+
const rot = ValueObjects_1.Quaternion.FromArray(data.rotation);
|
|
44
|
+
const scale = ValueObjects_1.Vector3.FromArray(data.scale);
|
|
45
|
+
this.sceneRoot.transform.lerp(transitionTime * 1000, this.stateMachine.transitionEaseFunction, pos, rot, scale);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SerializeSceneRoot = SerializeSceneRoot;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SerializeSceneRoot";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./SerializeSceneRoot"), exports);
|
package/lib/UseCases/index.d.ts
CHANGED
package/lib/UseCases/index.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
export declare class Angle {
|
|
2
|
+
/**
|
|
3
|
+
* Creates an angle from degrees
|
|
4
|
+
* @param degrees Angle in degrees
|
|
5
|
+
* @returns The angle
|
|
6
|
+
*/
|
|
2
7
|
static FromDegrees(degrees: number): Angle;
|
|
8
|
+
/**
|
|
9
|
+
* Creates an angle from radians
|
|
10
|
+
* @param radians Angle in radians
|
|
11
|
+
* @returns The angle
|
|
12
|
+
*/
|
|
3
13
|
static FromRadians(radians: number): Angle;
|
|
14
|
+
/**
|
|
15
|
+
* Check to see if two angles are close
|
|
16
|
+
* @param a Angle A
|
|
17
|
+
* @param b Angle B
|
|
18
|
+
* @param tolerance Tolerance for "Close" in degrees. Defaults to 0.001;
|
|
19
|
+
* @returns True if the difference between A and B (in degress) is less than the tolerance
|
|
20
|
+
*/
|
|
21
|
+
static Close(a: Angle, b: Angle, tolerance?: number): boolean;
|
|
4
22
|
private _degrees;
|
|
5
23
|
get degrees(): number;
|
|
6
24
|
get radians(): number;
|
|
@@ -6,17 +6,41 @@ class Angle {
|
|
|
6
6
|
this._degrees = 0;
|
|
7
7
|
this._degrees = degrees;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates an angle from degrees
|
|
11
|
+
* @param degrees Angle in degrees
|
|
12
|
+
* @returns The angle
|
|
13
|
+
*/
|
|
9
14
|
static FromDegrees(degrees) {
|
|
10
15
|
return new Angle(degrees);
|
|
11
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates an angle from radians
|
|
19
|
+
* @param radians Angle in radians
|
|
20
|
+
* @returns The angle
|
|
21
|
+
*/
|
|
12
22
|
static FromRadians(radians) {
|
|
13
|
-
return new Angle(radians * 180 / Math.PI);
|
|
23
|
+
return new Angle((radians * 180) / Math.PI);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check to see if two angles are close
|
|
27
|
+
* @param a Angle A
|
|
28
|
+
* @param b Angle B
|
|
29
|
+
* @param tolerance Tolerance for "Close" in degrees. Defaults to 0.001;
|
|
30
|
+
* @returns True if the difference between A and B (in degress) is less than the tolerance
|
|
31
|
+
*/
|
|
32
|
+
static Close(a, b, tolerance = 0.001) {
|
|
33
|
+
let diff = a.degrees - b.degrees;
|
|
34
|
+
if (diff < 0) {
|
|
35
|
+
diff = -diff;
|
|
36
|
+
}
|
|
37
|
+
return diff < tolerance;
|
|
14
38
|
}
|
|
15
39
|
get degrees() {
|
|
16
40
|
return this._degrees;
|
|
17
41
|
}
|
|
18
42
|
get radians() {
|
|
19
|
-
return this._degrees * Math.PI / 180;
|
|
43
|
+
return (this._degrees * Math.PI) / 180;
|
|
20
44
|
}
|
|
21
45
|
}
|
|
22
46
|
exports.Angle = Angle;
|
|
@@ -1,18 +1,64 @@
|
|
|
1
1
|
export declare type BasicColor = "";
|
|
2
2
|
export declare class Color {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Color from RGBA values
|
|
5
|
+
* @param r Red value, between 0-255
|
|
6
|
+
* @param g Green value, between 0-255
|
|
7
|
+
* @param b Blue value, between 0-255
|
|
8
|
+
* @param a Alpha value, between 0-255
|
|
9
|
+
* @returns The Color
|
|
10
|
+
*/
|
|
3
11
|
static RGBA(r: number, g: number, b: number, a: number): Color;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Color from RGB values. Alpha is set to 255
|
|
14
|
+
* @param r Red value, between 0-255
|
|
15
|
+
* @param g Green value, between 0-255
|
|
16
|
+
* @param b Blue value, between 0-255
|
|
17
|
+
* @returns The Color
|
|
18
|
+
*/
|
|
4
19
|
static RGB(r: number, g: number, b: number): Color;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a color from a Hex value
|
|
22
|
+
* @param hex The Hex string. Example '808080'
|
|
23
|
+
* @returns The Color
|
|
24
|
+
*/
|
|
5
25
|
static Hex(hex: string): Color;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a color from the X11 standard.
|
|
28
|
+
* @param name X11 name
|
|
29
|
+
* @returns The Color. If the color name is not found, it will return Black.
|
|
30
|
+
*/
|
|
6
31
|
static X11(name: string): Color;
|
|
32
|
+
/**
|
|
33
|
+
* Checks to see if Color A equals Color B
|
|
34
|
+
* @param a Color A
|
|
35
|
+
* @param b Color B
|
|
36
|
+
* @returns True if Color A === Color B
|
|
37
|
+
*/
|
|
7
38
|
static Equal(a: Color, b: Color): boolean;
|
|
8
39
|
readonly r: number;
|
|
9
40
|
readonly g: number;
|
|
10
41
|
readonly b: number;
|
|
11
42
|
readonly a: number;
|
|
43
|
+
/**
|
|
44
|
+
* Return the r value as a percent
|
|
45
|
+
*/
|
|
12
46
|
get rPercent(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Return the g value as a percent
|
|
49
|
+
*/
|
|
13
50
|
get gPercent(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Return the b value as a percent
|
|
53
|
+
*/
|
|
14
54
|
get bPercent(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Return the a value as a percent
|
|
57
|
+
*/
|
|
15
58
|
get aPercent(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the Color values as an array [r,g,b,a]
|
|
61
|
+
*/
|
|
16
62
|
get array(): [number, number, number, number];
|
|
17
63
|
private clampVal;
|
|
18
64
|
private constructor();
|
|
@@ -8,12 +8,32 @@ class Color {
|
|
|
8
8
|
this.b = this.clampVal(b);
|
|
9
9
|
this.a = this.clampVal(a);
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Color from RGBA values
|
|
13
|
+
* @param r Red value, between 0-255
|
|
14
|
+
* @param g Green value, between 0-255
|
|
15
|
+
* @param b Blue value, between 0-255
|
|
16
|
+
* @param a Alpha value, between 0-255
|
|
17
|
+
* @returns The Color
|
|
18
|
+
*/
|
|
11
19
|
static RGBA(r, g, b, a) {
|
|
12
20
|
return new Color(r, g, b, a);
|
|
13
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a Color from RGB values. Alpha is set to 255
|
|
24
|
+
* @param r Red value, between 0-255
|
|
25
|
+
* @param g Green value, between 0-255
|
|
26
|
+
* @param b Blue value, between 0-255
|
|
27
|
+
* @returns The Color
|
|
28
|
+
*/
|
|
14
29
|
static RGB(r, g, b) {
|
|
15
30
|
return new Color(r, g, b, 255);
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a color from a Hex value
|
|
34
|
+
* @param hex The Hex string. Example '808080'
|
|
35
|
+
* @returns The Color
|
|
36
|
+
*/
|
|
17
37
|
static Hex(hex) {
|
|
18
38
|
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
19
39
|
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
@@ -35,6 +55,11 @@ class Color {
|
|
|
35
55
|
}
|
|
36
56
|
return Color.RGB(r, g, b);
|
|
37
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a color from the X11 standard.
|
|
60
|
+
* @param name X11 name
|
|
61
|
+
* @returns The Color. If the color name is not found, it will return Black.
|
|
62
|
+
*/
|
|
38
63
|
static X11(name) {
|
|
39
64
|
for (const c of x11Colors) {
|
|
40
65
|
if (c.name === name) {
|
|
@@ -44,6 +69,12 @@ class Color {
|
|
|
44
69
|
console.warn("Unable to find X11 color by name: " + name);
|
|
45
70
|
return Color.RGB(0, 0, 0);
|
|
46
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks to see if Color A equals Color B
|
|
74
|
+
* @param a Color A
|
|
75
|
+
* @param b Color B
|
|
76
|
+
* @returns True if Color A === Color B
|
|
77
|
+
*/
|
|
47
78
|
static Equal(a, b) {
|
|
48
79
|
if (a.a !== b.a)
|
|
49
80
|
return false;
|
|
@@ -51,18 +82,33 @@ class Color {
|
|
|
51
82
|
return false;
|
|
52
83
|
return true;
|
|
53
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Return the r value as a percent
|
|
87
|
+
*/
|
|
54
88
|
get rPercent() {
|
|
55
89
|
return this.r / 255;
|
|
56
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Return the g value as a percent
|
|
93
|
+
*/
|
|
57
94
|
get gPercent() {
|
|
58
95
|
return this.g / 255;
|
|
59
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Return the b value as a percent
|
|
99
|
+
*/
|
|
60
100
|
get bPercent() {
|
|
61
101
|
return this.b / 255;
|
|
62
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Return the a value as a percent
|
|
105
|
+
*/
|
|
63
106
|
get aPercent() {
|
|
64
107
|
return this.a / 255;
|
|
65
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns the Color values as an array [r,g,b,a]
|
|
111
|
+
*/
|
|
66
112
|
get array() {
|
|
67
113
|
return [this.r, this.g, this.b, this.a];
|
|
68
114
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Angle } from "./Angle";
|
|
2
|
+
import { Quaternion } from "./Quaternion";
|
|
3
|
+
import { Vector3 } from "./Vector3";
|
|
4
|
+
export declare type MatrixArray = [
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
number,
|
|
14
|
+
number,
|
|
15
|
+
number,
|
|
16
|
+
number,
|
|
17
|
+
number,
|
|
18
|
+
number,
|
|
19
|
+
number,
|
|
20
|
+
number
|
|
21
|
+
];
|
|
22
|
+
export declare class Matrix {
|
|
23
|
+
/**
|
|
24
|
+
* Consructs an identity matrix
|
|
25
|
+
* @returns An identity matrix
|
|
26
|
+
*/
|
|
27
|
+
static Identity(): Matrix;
|
|
28
|
+
/**
|
|
29
|
+
* Constructs an matrix of zeros
|
|
30
|
+
* @returns A matrix of zeros
|
|
31
|
+
*/
|
|
32
|
+
static Zero(): Matrix;
|
|
33
|
+
/**
|
|
34
|
+
* Compares two matricies
|
|
35
|
+
* @param a Matrix A
|
|
36
|
+
* @param b Matrix B
|
|
37
|
+
* @returns True if all the elements in matrix A are equal to all the elements of matrix B
|
|
38
|
+
*/
|
|
39
|
+
static Equal(a: Matrix, b: Matrix): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Checks to see if Matrix A is close to Matrix B by comparing elements
|
|
42
|
+
* @param a Matrix A
|
|
43
|
+
* @param b Matrix B
|
|
44
|
+
* @param threshold "Close" thershold. Defaults to 0.001
|
|
45
|
+
* @returns True if all the difference between the elements in each array is less than the threshold
|
|
46
|
+
*/
|
|
47
|
+
static Close(a: Matrix, b: Matrix, threshold?: number): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Multiplies Matrix A and B (AxB)
|
|
50
|
+
* @param a Matrix A
|
|
51
|
+
* @param b Matrix B
|
|
52
|
+
* @returns The result of AxB
|
|
53
|
+
*/
|
|
54
|
+
static Multiply(a: Matrix, b: Matrix): Matrix;
|
|
55
|
+
/**
|
|
56
|
+
* Composes a matrix from a scale vector, rotation quaterion, and translation vector
|
|
57
|
+
* @param scale The scale of the transformation matrix
|
|
58
|
+
* @param rotation The rotation of the transformation matrix
|
|
59
|
+
* @param translation The translation of the transformation matrix
|
|
60
|
+
* @returns The composed matrix
|
|
61
|
+
*/
|
|
62
|
+
static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
|
|
63
|
+
/**
|
|
64
|
+
* Inverts a matrix into a new matrix.
|
|
65
|
+
* @param matrix The matrix to invert
|
|
66
|
+
* @returns The inverted matrix unless the matrix cannot be inverted, then the identity is returned
|
|
67
|
+
*/
|
|
68
|
+
static Invert(matrix: Matrix): Matrix;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a rotation matrix for a given axes and angle
|
|
71
|
+
* @param axis The axes of rotation
|
|
72
|
+
* @param angle The angle of rotation
|
|
73
|
+
* @returns A new rotation matrix
|
|
74
|
+
*/
|
|
75
|
+
static FromRotationAxisAngle(axis: Vector3, angle: Angle): Matrix;
|
|
76
|
+
/**
|
|
77
|
+
* Make a new transformation matrix that has the same scale and rotation as the original but the translation is set
|
|
78
|
+
* @param original The original matrix
|
|
79
|
+
* @param translation The new translation value
|
|
80
|
+
* @returns A new matrix that is the same as the original but the translation has been changed
|
|
81
|
+
*/
|
|
82
|
+
static SetMatrixTranslation(original: Matrix, translation: Vector3): Matrix;
|
|
83
|
+
/**
|
|
84
|
+
* Make a new transformation matrix that has the same scale and translation as the original but the rotation is set
|
|
85
|
+
* @param original The original matrix
|
|
86
|
+
* @param rotation The new rotation value
|
|
87
|
+
* @returns A new matrix that is the same as the original but the rotation has been changed
|
|
88
|
+
*/
|
|
89
|
+
static SetMatrixRotation(original: Matrix, rotation: Quaternion): Matrix;
|
|
90
|
+
/**
|
|
91
|
+
* Make a new transformation matrix that has the same rotation and translation as the original but the scale is set
|
|
92
|
+
* @param original The original matrix
|
|
93
|
+
* @param scale The new scale value
|
|
94
|
+
* @returns A new matrix that is the same as the original but the scale has been changed
|
|
95
|
+
*/
|
|
96
|
+
static SetMatrixScale(original: Matrix, scale: Vector3): Matrix;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the determinate of the matrix
|
|
99
|
+
*/
|
|
100
|
+
get determinate(): number;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the translation component of the transformation matrix as a Vector
|
|
103
|
+
*/
|
|
104
|
+
get translation(): Vector3;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the scale of the transformation matrix as a vector
|
|
107
|
+
*/
|
|
108
|
+
get scale(): Vector3;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the rotation components of the transformation matrix as a Quaternion
|
|
111
|
+
*/
|
|
112
|
+
get rotation(): Quaternion;
|
|
113
|
+
/**
|
|
114
|
+
* Returns just the rotation matrix of the transformation matrix
|
|
115
|
+
*/
|
|
116
|
+
get rotationMatrix(): Matrix;
|
|
117
|
+
private readonly _m;
|
|
118
|
+
get m(): MatrixArray;
|
|
119
|
+
constructor(m: MatrixArray);
|
|
120
|
+
}
|