@vived/core 1.4.0 → 1.4.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/package.json +3 -6
- package/dist/cjs/AppObject/AppObject.js +0 -59
- package/dist/cjs/AppObject/AppObject.js.map +0 -1
- package/dist/cjs/AppObject/AppObject.test.js +0 -113
- package/dist/cjs/AppObject/AppObject.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectComponent.js +0 -82
- package/dist/cjs/AppObject/AppObjectComponent.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectComponent.test.js +0 -132
- package/dist/cjs/AppObject/AppObjectComponent.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectController.js +0 -12
- package/dist/cjs/AppObject/AppObjectController.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntity.js +0 -38
- package/dist/cjs/AppObject/AppObjectEntity.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntity.test.js +0 -108
- package/dist/cjs/AppObject/AppObjectEntity.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntityRepo.js +0 -56
- package/dist/cjs/AppObject/AppObjectEntityRepo.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntityRepo.test.js +0 -149
- package/dist/cjs/AppObject/AppObjectEntityRepo.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectPM.js +0 -40
- package/dist/cjs/AppObject/AppObjectPM.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectPM.test.js +0 -103
- package/dist/cjs/AppObject/AppObjectPM.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectRepo.js +0 -133
- package/dist/cjs/AppObject/AppObjectRepo.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectRepo.test.js +0 -213
- package/dist/cjs/AppObject/AppObjectRepo.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectUC.js +0 -12
- package/dist/cjs/AppObject/AppObjectUC.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectView.js +0 -12
- package/dist/cjs/AppObject/AppObjectView.js.map +0 -1
- package/dist/cjs/AppObject/getSingletonComponent.js +0 -7
- package/dist/cjs/AppObject/getSingletonComponent.js.map +0 -1
- package/dist/cjs/AppObject/getSingletonComponent.test.js +0 -13
- package/dist/cjs/AppObject/getSingletonComponent.test.js.map +0 -1
- package/dist/cjs/AppObject/index.js +0 -27
- package/dist/cjs/AppObject/index.js.map +0 -1
- package/dist/cjs/AppObject/printAppObjectDetails.js +0 -18
- package/dist/cjs/AppObject/printAppObjectDetails.js.map +0 -1
- package/dist/cjs/Entities/MemoizedAngle.js +0 -23
- package/dist/cjs/Entities/MemoizedAngle.js.map +0 -1
- package/dist/cjs/Entities/MemoizedAngle.test.js +0 -30
- package/dist/cjs/Entities/MemoizedAngle.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedBoolean.js +0 -23
- package/dist/cjs/Entities/MemoizedBoolean.js.map +0 -1
- package/dist/cjs/Entities/MemoizedBoolean.test.js +0 -34
- package/dist/cjs/Entities/MemoizedBoolean.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedColor.js +0 -24
- package/dist/cjs/Entities/MemoizedColor.js.map +0 -1
- package/dist/cjs/Entities/MemoizedColor.test.js +0 -32
- package/dist/cjs/Entities/MemoizedColor.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedNumber.js +0 -23
- package/dist/cjs/Entities/MemoizedNumber.js.map +0 -1
- package/dist/cjs/Entities/MemoizedNumber.test.js +0 -29
- package/dist/cjs/Entities/MemoizedNumber.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedQuaternion.js +0 -24
- package/dist/cjs/Entities/MemoizedQuaternion.js.map +0 -1
- package/dist/cjs/Entities/MemoizedQuaternion.test.js +0 -32
- package/dist/cjs/Entities/MemoizedQuaternion.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedString.js +0 -23
- package/dist/cjs/Entities/MemoizedString.js.map +0 -1
- package/dist/cjs/Entities/MemoizedString.test.js +0 -29
- package/dist/cjs/Entities/MemoizedString.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector2.js +0 -24
- package/dist/cjs/Entities/MemoizedVector2.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector2.test.js +0 -32
- package/dist/cjs/Entities/MemoizedVector2.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector3.js +0 -24
- package/dist/cjs/Entities/MemoizedVector3.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector3.test.js +0 -32
- package/dist/cjs/Entities/MemoizedVector3.test.js.map +0 -1
- package/dist/cjs/Entities/ObservableEntity.js +0 -20
- package/dist/cjs/Entities/ObservableEntity.js.map +0 -1
- package/dist/cjs/Entities/ObservableEntity.test.js +0 -25
- package/dist/cjs/Entities/ObservableEntity.test.js.map +0 -1
- package/dist/cjs/Entities/ObserverList.js +0 -27
- package/dist/cjs/Entities/ObserverList.js.map +0 -1
- package/dist/cjs/Entities/ObserverList.test.js +0 -44
- package/dist/cjs/Entities/ObserverList.test.js.map +0 -1
- package/dist/cjs/Entities/RangedNumber.js +0 -36
- package/dist/cjs/Entities/RangedNumber.js.map +0 -1
- package/dist/cjs/Entities/RangedNumber.test.js +0 -96
- package/dist/cjs/Entities/RangedNumber.test.js.map +0 -1
- package/dist/cjs/Entities/index.js +0 -28
- package/dist/cjs/Entities/index.js.map +0 -1
- package/dist/cjs/Types/AppBoundary.js +0 -3
- package/dist/cjs/Types/AppBoundary.js.map +0 -1
- package/dist/cjs/Types/EaseFn.js +0 -3
- package/dist/cjs/Types/EaseFn.js.map +0 -1
- package/dist/cjs/Types/PmAdapter.js +0 -3
- package/dist/cjs/Types/PmAdapter.js.map +0 -1
- package/dist/cjs/Types/SingletonPmAdapter.js +0 -3
- package/dist/cjs/Types/SingletonPmAdapter.js.map +0 -1
- package/dist/cjs/Types/index.js +0 -21
- package/dist/cjs/Types/index.js.map +0 -1
- package/dist/cjs/Utilities/LengthConverters.js +0 -21
- package/dist/cjs/Utilities/LengthConverters.js.map +0 -1
- package/dist/cjs/Utilities/LengthConverters.test.js +0 -24
- package/dist/cjs/Utilities/LengthConverters.test.js.map +0 -1
- package/dist/cjs/Utilities/LerpNumber.js +0 -85
- package/dist/cjs/Utilities/LerpNumber.js.map +0 -1
- package/dist/cjs/Utilities/LerpNumber.test.js +0 -90
- package/dist/cjs/Utilities/LerpNumber.test.js.map +0 -1
- package/dist/cjs/Utilities/addAlphaToHex.js +0 -16
- package/dist/cjs/Utilities/addAlphaToHex.js.map +0 -1
- package/dist/cjs/Utilities/addAlphaToHex.test.js +0 -34
- package/dist/cjs/Utilities/addAlphaToHex.test.js.map +0 -1
- package/dist/cjs/Utilities/alphaToHex.js +0 -21
- package/dist/cjs/Utilities/alphaToHex.js.map +0 -1
- package/dist/cjs/Utilities/alphaToHex.test.js +0 -75
- package/dist/cjs/Utilities/alphaToHex.test.js.map +0 -1
- package/dist/cjs/Utilities/degreesToRadians.js +0 -7
- package/dist/cjs/Utilities/degreesToRadians.js.map +0 -1
- package/dist/cjs/Utilities/degreesToRadians.test.js +0 -9
- package/dist/cjs/Utilities/degreesToRadians.test.js.map +0 -1
- package/dist/cjs/Utilities/downloadFile.js +0 -14
- package/dist/cjs/Utilities/downloadFile.js.map +0 -1
- package/dist/cjs/Utilities/easeFunctions.js +0 -208
- package/dist/cjs/Utilities/easeFunctions.js.map +0 -1
- package/dist/cjs/Utilities/easeFunctions.test.js +0 -209
- package/dist/cjs/Utilities/easeFunctions.test.js.map +0 -1
- package/dist/cjs/Utilities/generateUniqueID.js +0 -8
- package/dist/cjs/Utilities/generateUniqueID.js.map +0 -1
- package/dist/cjs/Utilities/index.js +0 -25
- package/dist/cjs/Utilities/index.js.map +0 -1
- package/dist/cjs/Utilities/interpolateNumber.js +0 -18
- package/dist/cjs/Utilities/interpolateNumber.js.map +0 -1
- package/dist/cjs/Utilities/interpolateNumber.test.js +0 -26
- package/dist/cjs/Utilities/interpolateNumber.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Angle.js +0 -47
- package/dist/cjs/ValueObjects/Angle.js.map +0 -1
- package/dist/cjs/ValueObjects/Angle.test.js +0 -28
- package/dist/cjs/ValueObjects/Angle.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Color.js +0 -859
- package/dist/cjs/ValueObjects/Color.js.map +0 -1
- package/dist/cjs/ValueObjects/Color.test.js +0 -147
- package/dist/cjs/ValueObjects/Color.test.js.map +0 -1
- package/dist/cjs/ValueObjects/LineSegment2D.js +0 -72
- package/dist/cjs/ValueObjects/LineSegment2D.js.map +0 -1
- package/dist/cjs/ValueObjects/LineSegment2D.test.js +0 -102
- package/dist/cjs/ValueObjects/LineSegment2D.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Matrix.js +0 -466
- package/dist/cjs/ValueObjects/Matrix.js.map +0 -1
- package/dist/cjs/ValueObjects/Matrix.test.js +0 -385
- package/dist/cjs/ValueObjects/Matrix.test.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricLine.js +0 -77
- package/dist/cjs/ValueObjects/ParametricLine.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricLine.test.js +0 -126
- package/dist/cjs/ValueObjects/ParametricLine.test.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricPlane.js +0 -65
- package/dist/cjs/ValueObjects/ParametricPlane.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricPlane.test.js +0 -101
- package/dist/cjs/ValueObjects/ParametricPlane.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Quaternion.js +0 -290
- package/dist/cjs/ValueObjects/Quaternion.js.map +0 -1
- package/dist/cjs/ValueObjects/Quaternion.test.js +0 -240
- package/dist/cjs/ValueObjects/Quaternion.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Rectangle.js +0 -24
- package/dist/cjs/ValueObjects/Rectangle.js.map +0 -1
- package/dist/cjs/ValueObjects/Rectangle.test.js +0 -32
- package/dist/cjs/ValueObjects/Rectangle.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector2.js +0 -184
- package/dist/cjs/ValueObjects/Vector2.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector2.test.js +0 -136
- package/dist/cjs/ValueObjects/Vector2.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector3.js +0 -231
- package/dist/cjs/ValueObjects/Vector3.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector3.test.js +0 -188
- package/dist/cjs/ValueObjects/Vector3.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Version.js +0 -171
- package/dist/cjs/ValueObjects/Version.js.map +0 -1
- package/dist/cjs/ValueObjects/Version.test.js +0 -310
- package/dist/cjs/ValueObjects/Version.test.js.map +0 -1
- package/dist/cjs/ValueObjects/index.js +0 -28
- package/dist/cjs/ValueObjects/index.js.map +0 -1
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/index.js.map +0 -1
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Angle_1 = require("./Angle");
|
|
4
|
-
const Matrix_1 = require("./Matrix");
|
|
5
|
-
const Quaternion_1 = require("./Quaternion");
|
|
6
|
-
const Vector3_1 = require("./Vector3");
|
|
7
|
-
describe("Matrix Value Object", () => {
|
|
8
|
-
it("Forms an identity matrix", () => {
|
|
9
|
-
const identity = Matrix_1.Matrix.Identity();
|
|
10
|
-
const expected = new Matrix_1.Matrix(identityArray);
|
|
11
|
-
expect(identity).toEqual(expected);
|
|
12
|
-
});
|
|
13
|
-
it("Forms a zero matrix", () => {
|
|
14
|
-
const identity = Matrix_1.Matrix.Zero();
|
|
15
|
-
const expected = new Matrix_1.Matrix(zeroArray);
|
|
16
|
-
expect(identity).toEqual(expected);
|
|
17
|
-
});
|
|
18
|
-
it("Checks to see if two matricies are equal", () => {
|
|
19
|
-
const m1 = new Matrix_1.Matrix(sequentialArray);
|
|
20
|
-
const m2 = new Matrix_1.Matrix(sequentialArray);
|
|
21
|
-
const m3 = new Matrix_1.Matrix(zeroArray);
|
|
22
|
-
expect(Matrix_1.Matrix.Equal(m1, m2)).toEqual(true);
|
|
23
|
-
expect(Matrix_1.Matrix.Equal(m1, m3)).toEqual(false);
|
|
24
|
-
});
|
|
25
|
-
it("Checks for eqaulity during tests", () => {
|
|
26
|
-
const m1 = new Matrix_1.Matrix(sequentialArray);
|
|
27
|
-
const m2 = new Matrix_1.Matrix(sequentialArray);
|
|
28
|
-
expect(m1).toEqual(m2);
|
|
29
|
-
});
|
|
30
|
-
it("Returns the translation", () => {
|
|
31
|
-
const m1 = new Matrix_1.Matrix(sequentialArray);
|
|
32
|
-
expect(m1.translation).toEqual(new Vector3_1.Vector3(13, 14, 15));
|
|
33
|
-
});
|
|
34
|
-
it("Multipiles two matricies", () => {
|
|
35
|
-
const m1 = new Matrix_1.Matrix(sequentialArray);
|
|
36
|
-
const m2 = new Matrix_1.Matrix([
|
|
37
|
-
16,
|
|
38
|
-
15,
|
|
39
|
-
14,
|
|
40
|
-
13,
|
|
41
|
-
12,
|
|
42
|
-
11,
|
|
43
|
-
10,
|
|
44
|
-
9,
|
|
45
|
-
8,
|
|
46
|
-
7,
|
|
47
|
-
6,
|
|
48
|
-
5,
|
|
49
|
-
4,
|
|
50
|
-
3,
|
|
51
|
-
2,
|
|
52
|
-
1,
|
|
53
|
-
]);
|
|
54
|
-
const expected = new Matrix_1.Matrix([
|
|
55
|
-
386,
|
|
56
|
-
444,
|
|
57
|
-
502,
|
|
58
|
-
560,
|
|
59
|
-
274,
|
|
60
|
-
316,
|
|
61
|
-
358,
|
|
62
|
-
400,
|
|
63
|
-
162,
|
|
64
|
-
188,
|
|
65
|
-
214,
|
|
66
|
-
240,
|
|
67
|
-
50,
|
|
68
|
-
60,
|
|
69
|
-
70,
|
|
70
|
-
80,
|
|
71
|
-
]);
|
|
72
|
-
const result = Matrix_1.Matrix.Multiply(m1, m2);
|
|
73
|
-
expect(result.m).toEqual(expected.m);
|
|
74
|
-
});
|
|
75
|
-
it("Composes an Identity matrix", () => {
|
|
76
|
-
const pos = Vector3_1.Vector3.Zero();
|
|
77
|
-
const scale = Vector3_1.Vector3.One();
|
|
78
|
-
const rot = Quaternion_1.Quaternion.Identity();
|
|
79
|
-
const mat = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
80
|
-
expect(mat).toEqual(Matrix_1.Matrix.Identity());
|
|
81
|
-
});
|
|
82
|
-
it("Composes a matrix with a position", () => {
|
|
83
|
-
const pos = new Vector3_1.Vector3(11, 22, 33);
|
|
84
|
-
const scale = Vector3_1.Vector3.One();
|
|
85
|
-
const rot = Quaternion_1.Quaternion.Identity();
|
|
86
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
87
|
-
const expected = new Matrix_1.Matrix([
|
|
88
|
-
1,
|
|
89
|
-
0,
|
|
90
|
-
0,
|
|
91
|
-
0,
|
|
92
|
-
0,
|
|
93
|
-
1,
|
|
94
|
-
0,
|
|
95
|
-
0,
|
|
96
|
-
0,
|
|
97
|
-
0,
|
|
98
|
-
1,
|
|
99
|
-
0,
|
|
100
|
-
11,
|
|
101
|
-
22,
|
|
102
|
-
33,
|
|
103
|
-
1,
|
|
104
|
-
]);
|
|
105
|
-
expect(composed).toEqual(expected);
|
|
106
|
-
});
|
|
107
|
-
it("Composes a matrix with scale", () => {
|
|
108
|
-
const pos = Vector3_1.Vector3.Zero();
|
|
109
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
110
|
-
const rot = Quaternion_1.Quaternion.Identity();
|
|
111
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
112
|
-
const expected = new Matrix_1.Matrix([
|
|
113
|
-
6,
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
0,
|
|
117
|
-
0,
|
|
118
|
-
7,
|
|
119
|
-
0,
|
|
120
|
-
0,
|
|
121
|
-
0,
|
|
122
|
-
0,
|
|
123
|
-
8,
|
|
124
|
-
0,
|
|
125
|
-
0,
|
|
126
|
-
0,
|
|
127
|
-
0,
|
|
128
|
-
1,
|
|
129
|
-
]);
|
|
130
|
-
expect(composed).toEqual(expected);
|
|
131
|
-
});
|
|
132
|
-
it("Composes a matrix with rotation", () => {
|
|
133
|
-
// Number are from Babylon
|
|
134
|
-
const pos = Vector3_1.Vector3.Zero();
|
|
135
|
-
const scale = Vector3_1.Vector3.One();
|
|
136
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
137
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
138
|
-
expect(composed.m[0]).toBeCloseTo(0.5199598670005798);
|
|
139
|
-
expect(composed.m[1]).toBeCloseTo(0.07624746859073639);
|
|
140
|
-
expect(composed.m[2]).toBeCloseTo(0.8507808446884155);
|
|
141
|
-
expect(composed.m[4]).toBeCloseTo(-0.6987635493278503);
|
|
142
|
-
expect(composed.m[5]).toBeCloseTo(-0.5348952412605286);
|
|
143
|
-
expect(composed.m[6]).toBeCloseTo(0.47499117255210876);
|
|
144
|
-
expect(composed.m[8]).toBeCloseTo(0.4912954866886139);
|
|
145
|
-
expect(composed.m[9]).toBeCloseTo(-0.8414709568023682);
|
|
146
|
-
expect(composed.m[10]).toBeCloseTo(-0.22484509646892548);
|
|
147
|
-
});
|
|
148
|
-
it("Calculates a determinant", () => {
|
|
149
|
-
const sequential = new Matrix_1.Matrix(sequentialArray);
|
|
150
|
-
expect(sequential.determinate).toEqual(0);
|
|
151
|
-
const identity = Matrix_1.Matrix.Identity();
|
|
152
|
-
expect(identity.determinate).toEqual(1);
|
|
153
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
154
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
155
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
156
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
157
|
-
expect(composed.determinate).toBeCloseTo(335.99999908851385); // Number is from babylon
|
|
158
|
-
});
|
|
159
|
-
it("Returns the translation", () => {
|
|
160
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
161
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
162
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
163
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
164
|
-
expect(composed.translation).toEqual(pos);
|
|
165
|
-
});
|
|
166
|
-
it("Returns the scale", () => {
|
|
167
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
168
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
169
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
170
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
171
|
-
expect(composed.scale.x).toBeCloseTo(scale.x);
|
|
172
|
-
expect(composed.scale.y).toBeCloseTo(scale.y);
|
|
173
|
-
expect(composed.scale.z).toBeCloseTo(scale.z);
|
|
174
|
-
});
|
|
175
|
-
it("Returns the negative scale", () => {
|
|
176
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
177
|
-
const scale = new Vector3_1.Vector3(6, -7, 8);
|
|
178
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
179
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
180
|
-
expect(composed.scale.x).toBeCloseTo(scale.x);
|
|
181
|
-
expect(composed.scale.y).toBeCloseTo(scale.y);
|
|
182
|
-
expect(composed.scale.z).toBeCloseTo(scale.z);
|
|
183
|
-
});
|
|
184
|
-
it("Returns a rotation matrix", () => {
|
|
185
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
186
|
-
const scale = new Vector3_1.Vector3(6, -7, 8);
|
|
187
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
188
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
189
|
-
const expected = Matrix_1.Matrix.Compose(Vector3_1.Vector3.One(), rot, Vector3_1.Vector3.Zero());
|
|
190
|
-
expect(Matrix_1.Matrix.Close(composed.rotationMatrix, expected)).toEqual(true);
|
|
191
|
-
});
|
|
192
|
-
it("Returns the rotation", () => {
|
|
193
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
194
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
195
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
196
|
-
const composed = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
197
|
-
expect(Quaternion_1.Quaternion.Close(composed.rotation, rot)).toEqual(true);
|
|
198
|
-
});
|
|
199
|
-
it("Checks if matricies are close", () => {
|
|
200
|
-
const m1 = new Matrix_1.Matrix(sequentialArray);
|
|
201
|
-
const biggerValues = [...sequentialArray];
|
|
202
|
-
biggerValues.forEach((val, i) => {
|
|
203
|
-
biggerValues[i] = val + 0.01; // Just a little bump
|
|
204
|
-
});
|
|
205
|
-
const bigger = new Matrix_1.Matrix(biggerValues);
|
|
206
|
-
const smallerValues = [...sequentialArray];
|
|
207
|
-
smallerValues.forEach((val, i) => {
|
|
208
|
-
smallerValues[i] = val - 0.01; // Just a little bump
|
|
209
|
-
});
|
|
210
|
-
const smaller = new Matrix_1.Matrix(smallerValues);
|
|
211
|
-
expect(Matrix_1.Matrix.Close(m1, bigger, 0.0101)).toEqual(true);
|
|
212
|
-
expect(Matrix_1.Matrix.Close(m1, bigger, 0.0099)).toEqual(false);
|
|
213
|
-
expect(Matrix_1.Matrix.Close(m1, smaller, 0.0101)).toEqual(true);
|
|
214
|
-
expect(Matrix_1.Matrix.Close(m1, smaller, 0.0099)).toEqual(false);
|
|
215
|
-
});
|
|
216
|
-
it("Results in an Identity if we invert the identity", () => {
|
|
217
|
-
const identity = Matrix_1.Matrix.Identity();
|
|
218
|
-
const inverted = Matrix_1.Matrix.Invert(identity);
|
|
219
|
-
expect(Matrix_1.Matrix.Close(inverted, identity)).toEqual(true);
|
|
220
|
-
});
|
|
221
|
-
it("Inverts a matrix", () => {
|
|
222
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
223
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
224
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
225
|
-
const mat = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
226
|
-
const inverted = Matrix_1.Matrix.Invert(mat);
|
|
227
|
-
// Numbers are from babylon
|
|
228
|
-
const expected = new Matrix_1.Matrix([
|
|
229
|
-
0.08665996789932251,
|
|
230
|
-
-0.09982336312532425,
|
|
231
|
-
0.061411935836076736,
|
|
232
|
-
-0,
|
|
233
|
-
0.0127079077064991,
|
|
234
|
-
-0.0764136016368866,
|
|
235
|
-
-0.10518387705087662,
|
|
236
|
-
0,
|
|
237
|
-
0.14179681241512299,
|
|
238
|
-
0.06785587966442108,
|
|
239
|
-
-0.028105635195970535,
|
|
240
|
-
-0,
|
|
241
|
-
-6.435692310333252,
|
|
242
|
-
2.314870595932007,
|
|
243
|
-
2.1373696327209473,
|
|
244
|
-
1,
|
|
245
|
-
]);
|
|
246
|
-
expect(Matrix_1.Matrix.Close(inverted, expected)).toEqual(true);
|
|
247
|
-
});
|
|
248
|
-
it("Creates a rotation matrix from an axis ange angle", () => {
|
|
249
|
-
const axis = new Vector3_1.Vector3(1, 2, 3);
|
|
250
|
-
const angle = Angle_1.Angle.FromRadians(1.3);
|
|
251
|
-
const rotationMatrix = Matrix_1.Matrix.FromRotationAxisAngle(axis, angle);
|
|
252
|
-
// Numbers are from babylon
|
|
253
|
-
const expected = new Matrix_1.Matrix([
|
|
254
|
-
0.3198203444480896,
|
|
255
|
-
0.8772082924842834,
|
|
256
|
-
-0.3580789864063263,
|
|
257
|
-
0,
|
|
258
|
-
-0.6679222583770752,
|
|
259
|
-
0.476784884929657,
|
|
260
|
-
0.5714508295059204,
|
|
261
|
-
0,
|
|
262
|
-
0.6720080375671387,
|
|
263
|
-
0.05640731751918793,
|
|
264
|
-
0.7383924126625061,
|
|
265
|
-
0,
|
|
266
|
-
0,
|
|
267
|
-
0,
|
|
268
|
-
0,
|
|
269
|
-
1,
|
|
270
|
-
]);
|
|
271
|
-
expect(Matrix_1.Matrix.Close(rotationMatrix, expected)).toEqual(true);
|
|
272
|
-
});
|
|
273
|
-
it("Sets the transformation of a matrix", () => {
|
|
274
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
275
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
276
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
277
|
-
const mat = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
278
|
-
const newTrans = new Vector3_1.Vector3(3, 2, 1);
|
|
279
|
-
const newMat = Matrix_1.Matrix.SetMatrixTranslation(mat, newTrans);
|
|
280
|
-
expect(Quaternion_1.Quaternion.Close(newMat.rotation, rot)).toEqual(true);
|
|
281
|
-
expect(Vector3_1.Vector3.Close(newMat.translation, newTrans)).toEqual(true);
|
|
282
|
-
expect(Vector3_1.Vector3.Close(newMat.scale, scale)).toEqual(true);
|
|
283
|
-
});
|
|
284
|
-
it("Sets the rotation of a matrix", () => {
|
|
285
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
286
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
287
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
288
|
-
const mat = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
289
|
-
const newRotation = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1.1), Angle_1.Angle.FromRadians(2.2), Angle_1.Angle.FromRadians(3.3));
|
|
290
|
-
const newMat = Matrix_1.Matrix.SetMatrixRotation(mat, newRotation);
|
|
291
|
-
expect(Quaternion_1.Quaternion.Close(newMat.rotation, newRotation)).toEqual(true);
|
|
292
|
-
expect(Vector3_1.Vector3.Close(newMat.translation, pos)).toEqual(true);
|
|
293
|
-
expect(Vector3_1.Vector3.Close(newMat.scale, scale)).toEqual(true);
|
|
294
|
-
});
|
|
295
|
-
it("Sets the scale of a matrix", () => {
|
|
296
|
-
const pos = new Vector3_1.Vector3(23, 26, 29);
|
|
297
|
-
const scale = new Vector3_1.Vector3(6, 7, 8);
|
|
298
|
-
const rot = Quaternion_1.Quaternion.FromEuler(Angle_1.Angle.FromRadians(1), Angle_1.Angle.FromRadians(2), Angle_1.Angle.FromRadians(3));
|
|
299
|
-
const mat = Matrix_1.Matrix.Compose(scale, rot, pos);
|
|
300
|
-
const newScale = new Vector3_1.Vector3(1, 2, 3);
|
|
301
|
-
const newMat = Matrix_1.Matrix.SetMatrixScale(mat, newScale);
|
|
302
|
-
expect(Quaternion_1.Quaternion.Close(newMat.rotation, rot)).toEqual(true);
|
|
303
|
-
expect(Vector3_1.Vector3.Close(newMat.translation, pos)).toEqual(true);
|
|
304
|
-
expect(Vector3_1.Vector3.Close(newMat.scale, newScale)).toEqual(true);
|
|
305
|
-
});
|
|
306
|
-
it("Makes a Matrix from a Float 32 Array", () => {
|
|
307
|
-
const float32Array = new Float32Array(16);
|
|
308
|
-
for (let index = 0; index < 16; index++) {
|
|
309
|
-
float32Array[index] = index * 2;
|
|
310
|
-
}
|
|
311
|
-
const matrix = Matrix_1.Matrix.FromFloat32Array(float32Array);
|
|
312
|
-
for (let index = 0; index < 16; index++) {
|
|
313
|
-
expect(matrix.m[index]).toEqual(index * 2);
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
it("Logs an error and return the identity if the float 32 array does not have 16 itesm", () => {
|
|
317
|
-
const float32Array = new Float32Array(1);
|
|
318
|
-
console.error = jest.fn();
|
|
319
|
-
const matrix = Matrix_1.Matrix.FromFloat32Array(float32Array);
|
|
320
|
-
expect(console.error).toBeCalled();
|
|
321
|
-
expect(matrix).toEqual(Matrix_1.Matrix.Identity());
|
|
322
|
-
});
|
|
323
|
-
it("Flips the handedness of a transform matrix", () => {
|
|
324
|
-
const matrix = new Matrix_1.Matrix(sequentialArray);
|
|
325
|
-
const flipped = Matrix_1.Matrix.FlipTransformMatrixHand(matrix);
|
|
326
|
-
for (let index = 0; index < 16; index++) {
|
|
327
|
-
if (index === 2 || index === 6 || index === 8 || index === 9 || index === 14) {
|
|
328
|
-
expect(matrix.m[index]).toEqual(-flipped.m[index]);
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
expect(matrix.m[index]).toEqual(flipped.m[index]);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
it("Flips the handedness of a projection matrix", () => {
|
|
336
|
-
const matrix = new Matrix_1.Matrix(sequentialArray);
|
|
337
|
-
const flipped = Matrix_1.Matrix.FlipProjectionMatrixHand(matrix);
|
|
338
|
-
for (let index = 0; index < 16; index++) {
|
|
339
|
-
if (index === 8 || index === 9 || index === 10 || index === 11) {
|
|
340
|
-
expect(matrix.m[index]).toEqual(-flipped.m[index]);
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
expect(matrix.m[index]).toEqual(flipped.m[index]);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
const identityArray = [
|
|
349
|
-
1,
|
|
350
|
-
0,
|
|
351
|
-
0,
|
|
352
|
-
0,
|
|
353
|
-
0,
|
|
354
|
-
1,
|
|
355
|
-
0,
|
|
356
|
-
0,
|
|
357
|
-
0,
|
|
358
|
-
0,
|
|
359
|
-
1,
|
|
360
|
-
0,
|
|
361
|
-
0,
|
|
362
|
-
0,
|
|
363
|
-
0,
|
|
364
|
-
1,
|
|
365
|
-
];
|
|
366
|
-
const zeroArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
367
|
-
const sequentialArray = [
|
|
368
|
-
1,
|
|
369
|
-
2,
|
|
370
|
-
3,
|
|
371
|
-
4,
|
|
372
|
-
5,
|
|
373
|
-
6,
|
|
374
|
-
7,
|
|
375
|
-
8,
|
|
376
|
-
9,
|
|
377
|
-
10,
|
|
378
|
-
11,
|
|
379
|
-
12,
|
|
380
|
-
13,
|
|
381
|
-
14,
|
|
382
|
-
15,
|
|
383
|
-
16,
|
|
384
|
-
];
|
|
385
|
-
//# sourceMappingURL=Matrix.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Matrix.test.js","sourceRoot":"","sources":["../../../src/ValueObjects/Matrix.test.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAChC,qCAA+C;AAC/C,6CAA0C;AAC1C,uCAAoC;AAEpC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,QAAQ,GAAG,eAAM,CAAC,QAAQ,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,eAAM,CAAC,aAAa,CAAC,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,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,CAAC,KAAK,CAAC,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAgB;IACjC,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;CACF,CAAC;AAEF,MAAM,SAAS,GAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhF,MAAM,eAAe,GAAgB;IACnC,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;CACH,CAAC","sourcesContent":["import { Angle } from \"./Angle\";\r\nimport { Matrix, MatrixArray } from \"./Matrix\";\r\nimport { Quaternion } from \"./Quaternion\";\r\nimport { Vector3 } from \"./Vector3\";\r\n\r\ndescribe(\"Matrix Value Object\", () => {\r\n it(\"Forms an identity matrix\", () => {\r\n const identity = Matrix.Identity();\r\n const expected = new Matrix(identityArray);\r\n expect(identity).toEqual(expected);\r\n });\r\n\r\n it(\"Forms a zero matrix\", () => {\r\n const identity = Matrix.Zero();\r\n const expected = new Matrix(zeroArray);\r\n expect(identity).toEqual(expected);\r\n });\r\n\r\n it(\"Checks to see if two matricies are equal\", () => {\r\n const m1 = new Matrix(sequentialArray);\r\n const m2 = new Matrix(sequentialArray);\r\n const m3 = new Matrix(zeroArray);\r\n\r\n expect(Matrix.Equal(m1, m2)).toEqual(true);\r\n expect(Matrix.Equal(m1, m3)).toEqual(false);\r\n });\r\n\r\n it(\"Checks for eqaulity during tests\", () => {\r\n const m1 = new Matrix(sequentialArray);\r\n const m2 = new Matrix(sequentialArray);\r\n\r\n expect(m1).toEqual(m2);\r\n });\r\n\r\n it(\"Returns the translation\", () => {\r\n const m1 = new Matrix(sequentialArray);\r\n\r\n expect(m1.translation).toEqual(new Vector3(13, 14, 15));\r\n });\r\n\r\n it(\"Multipiles two matricies\", () => {\r\n const m1 = new Matrix(sequentialArray);\r\n const m2 = new Matrix([\r\n 16,\r\n 15,\r\n 14,\r\n 13,\r\n 12,\r\n 11,\r\n 10,\r\n 9,\r\n 8,\r\n 7,\r\n 6,\r\n 5,\r\n 4,\r\n 3,\r\n 2,\r\n 1,\r\n ]);\r\n const expected = new Matrix([\r\n 386,\r\n 444,\r\n 502,\r\n 560,\r\n 274,\r\n 316,\r\n 358,\r\n 400,\r\n 162,\r\n 188,\r\n 214,\r\n 240,\r\n 50,\r\n 60,\r\n 70,\r\n 80,\r\n ]);\r\n const result = Matrix.Multiply(m1, m2);\r\n expect(result.m).toEqual(expected.m);\r\n });\r\n\r\n it(\"Composes an Identity matrix\", () => {\r\n const pos = Vector3.Zero();\r\n const scale = Vector3.One();\r\n const rot = Quaternion.Identity();\r\n\r\n const mat = Matrix.Compose(scale, rot, pos);\r\n expect(mat).toEqual(Matrix.Identity());\r\n });\r\n\r\n it(\"Composes a matrix with a position\", () => {\r\n const pos = new Vector3(11, 22, 33);\r\n const scale = Vector3.One();\r\n const rot = Quaternion.Identity();\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n const expected = new Matrix([\r\n 1,\r\n 0,\r\n 0,\r\n 0,\r\n\r\n 0,\r\n 1,\r\n 0,\r\n 0,\r\n\r\n 0,\r\n 0,\r\n 1,\r\n 0,\r\n\r\n 11,\r\n 22,\r\n 33,\r\n 1,\r\n ]);\r\n expect(composed).toEqual(expected);\r\n });\r\n\r\n it(\"Composes a matrix with scale\", () => {\r\n const pos = Vector3.Zero();\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.Identity();\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n const expected = new Matrix([\r\n 6,\r\n 0,\r\n 0,\r\n 0,\r\n\r\n 0,\r\n 7,\r\n 0,\r\n 0,\r\n\r\n 0,\r\n 0,\r\n 8,\r\n 0,\r\n\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n ]);\r\n expect(composed).toEqual(expected);\r\n });\r\n\r\n it(\"Composes a matrix with rotation\", () => {\r\n // Number are from Babylon\r\n const pos = Vector3.Zero();\r\n const scale = Vector3.One();\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n expect(composed.m[0]).toBeCloseTo(0.5199598670005798);\r\n expect(composed.m[1]).toBeCloseTo(0.07624746859073639);\r\n expect(composed.m[2]).toBeCloseTo(0.8507808446884155);\r\n\r\n expect(composed.m[4]).toBeCloseTo(-0.6987635493278503);\r\n expect(composed.m[5]).toBeCloseTo(-0.5348952412605286);\r\n expect(composed.m[6]).toBeCloseTo(0.47499117255210876);\r\n\r\n expect(composed.m[8]).toBeCloseTo(0.4912954866886139);\r\n expect(composed.m[9]).toBeCloseTo(-0.8414709568023682);\r\n expect(composed.m[10]).toBeCloseTo(-0.22484509646892548);\r\n });\r\n\r\n it(\"Calculates a determinant\", () => {\r\n const sequential = new Matrix(sequentialArray);\r\n expect(sequential.determinate).toEqual(0);\r\n\r\n const identity = Matrix.Identity();\r\n expect(identity.determinate).toEqual(1);\r\n\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n expect(composed.determinate).toBeCloseTo(335.99999908851385); // Number is from babylon\r\n });\r\n\r\n it(\"Returns the translation\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n expect(composed.translation).toEqual(pos);\r\n });\r\n\r\n it(\"Returns the scale\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n expect(composed.scale.x).toBeCloseTo(scale.x);\r\n expect(composed.scale.y).toBeCloseTo(scale.y);\r\n expect(composed.scale.z).toBeCloseTo(scale.z);\r\n });\r\n\r\n it(\"Returns the negative scale\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, -7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n expect(composed.scale.x).toBeCloseTo(scale.x);\r\n expect(composed.scale.y).toBeCloseTo(scale.y);\r\n expect(composed.scale.z).toBeCloseTo(scale.z);\r\n });\r\n\r\n it(\"Returns a rotation matrix\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, -7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n const expected = Matrix.Compose(Vector3.One(), rot, Vector3.Zero());\r\n\r\n expect(Matrix.Close(composed.rotationMatrix, expected)).toEqual(true);\r\n });\r\n\r\n it(\"Returns the rotation\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n const composed = Matrix.Compose(scale, rot, pos);\r\n\r\n expect(Quaternion.Close(composed.rotation, rot)).toEqual(true);\r\n });\r\n\r\n it(\"Checks if matricies are close\", () => {\r\n const m1 = new Matrix(sequentialArray);\r\n const biggerValues: MatrixArray = [...sequentialArray];\r\n biggerValues.forEach((val, i) => {\r\n biggerValues[i] = val + 0.01; // Just a little bump\r\n });\r\n const bigger = new Matrix(biggerValues);\r\n\r\n const smallerValues: MatrixArray = [...sequentialArray];\r\n smallerValues.forEach((val, i) => {\r\n smallerValues[i] = val - 0.01; // Just a little bump\r\n });\r\n const smaller = new Matrix(smallerValues);\r\n\r\n expect(Matrix.Close(m1, bigger, 0.0101)).toEqual(true);\r\n expect(Matrix.Close(m1, bigger, 0.0099)).toEqual(false);\r\n\r\n expect(Matrix.Close(m1, smaller, 0.0101)).toEqual(true);\r\n expect(Matrix.Close(m1, smaller, 0.0099)).toEqual(false);\r\n });\r\n\r\n it(\"Results in an Identity if we invert the identity\", () => {\r\n const identity = Matrix.Identity();\r\n const inverted = Matrix.Invert(identity);\r\n\r\n expect(Matrix.Close(inverted, identity)).toEqual(true);\r\n });\r\n\r\n it(\"Inverts a matrix\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n const mat = Matrix.Compose(scale, rot, pos);\r\n const inverted = Matrix.Invert(mat);\r\n\r\n // Numbers are from babylon\r\n const expected = new Matrix([\r\n 0.08665996789932251,\r\n -0.09982336312532425,\r\n 0.061411935836076736,\r\n -0,\r\n 0.0127079077064991,\r\n -0.0764136016368866,\r\n -0.10518387705087662,\r\n 0,\r\n 0.14179681241512299,\r\n 0.06785587966442108,\r\n -0.028105635195970535,\r\n -0,\r\n -6.435692310333252,\r\n 2.314870595932007,\r\n 2.1373696327209473,\r\n 1,\r\n ]);\r\n\r\n expect(Matrix.Close(inverted, expected)).toEqual(true);\r\n });\r\n\r\n it(\"Creates a rotation matrix from an axis ange angle\", () => {\r\n const axis = new Vector3(1, 2, 3);\r\n const angle = Angle.FromRadians(1.3);\r\n const rotationMatrix = Matrix.FromRotationAxisAngle(axis, angle);\r\n\r\n // Numbers are from babylon\r\n const expected = new Matrix([\r\n 0.3198203444480896,\r\n 0.8772082924842834,\r\n -0.3580789864063263,\r\n 0,\r\n -0.6679222583770752,\r\n 0.476784884929657,\r\n 0.5714508295059204,\r\n 0,\r\n 0.6720080375671387,\r\n 0.05640731751918793,\r\n 0.7383924126625061,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n ]);\r\n\r\n expect(Matrix.Close(rotationMatrix, expected)).toEqual(true);\r\n });\r\n\r\n it(\"Sets the transformation of a matrix\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n const mat = Matrix.Compose(scale, rot, pos);\r\n\r\n const newTrans = new Vector3(3, 2, 1);\r\n const newMat = Matrix.SetMatrixTranslation(mat, newTrans);\r\n expect(Quaternion.Close(newMat.rotation, rot)).toEqual(true);\r\n expect(Vector3.Close(newMat.translation, newTrans)).toEqual(true);\r\n expect(Vector3.Close(newMat.scale, scale)).toEqual(true);\r\n });\r\n\r\n it(\"Sets the rotation of a matrix\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n const mat = Matrix.Compose(scale, rot, pos);\r\n\r\n const newRotation = Quaternion.FromEuler(\r\n Angle.FromRadians(1.1),\r\n Angle.FromRadians(2.2),\r\n Angle.FromRadians(3.3)\r\n );\r\n const newMat = Matrix.SetMatrixRotation(mat, newRotation);\r\n expect(Quaternion.Close(newMat.rotation, newRotation)).toEqual(true);\r\n expect(Vector3.Close(newMat.translation, pos)).toEqual(true);\r\n expect(Vector3.Close(newMat.scale, scale)).toEqual(true);\r\n });\r\n\r\n it(\"Sets the scale of a matrix\", () => {\r\n const pos = new Vector3(23, 26, 29);\r\n const scale = new Vector3(6, 7, 8);\r\n const rot = Quaternion.FromEuler(\r\n Angle.FromRadians(1),\r\n Angle.FromRadians(2),\r\n Angle.FromRadians(3)\r\n );\r\n const mat = Matrix.Compose(scale, rot, pos);\r\n\r\n const newScale = new Vector3(1, 2, 3);\r\n const newMat = Matrix.SetMatrixScale(mat, newScale);\r\n expect(Quaternion.Close(newMat.rotation, rot)).toEqual(true);\r\n expect(Vector3.Close(newMat.translation, pos)).toEqual(true);\r\n expect(Vector3.Close(newMat.scale, newScale)).toEqual(true);\r\n });\r\n\r\n it(\"Makes a Matrix from a Float 32 Array\", () => {\r\n const float32Array = new Float32Array(16);\r\n for (let index = 0; index < 16; index++) {\r\n float32Array[index] = index * 2;\r\n }\r\n\r\n const matrix = Matrix.FromFloat32Array(float32Array);\r\n\r\n for (let index = 0; index < 16; index++) {\r\n expect(matrix.m[index]).toEqual(index * 2);\r\n }\r\n })\r\n\r\n it(\"Logs an error and return the identity if the float 32 array does not have 16 itesm\", () => {\r\n const float32Array = new Float32Array(1);\r\n console.error = jest.fn();\r\n const matrix = Matrix.FromFloat32Array(float32Array);\r\n\r\n expect(console.error).toBeCalled();\r\n expect(matrix).toEqual(Matrix.Identity());\r\n })\r\n\r\n it(\"Flips the handedness of a transform matrix\", () => {\r\n const matrix = new Matrix(sequentialArray);\r\n const flipped = Matrix.FlipTransformMatrixHand(matrix);\r\n\r\n for (let index = 0; index < 16; index++) {\r\n if (index === 2 || index === 6 || index === 8 || index === 9 || index === 14) {\r\n expect(matrix.m[index]).toEqual(-flipped.m[index]);\r\n } else {\r\n expect(matrix.m[index]).toEqual(flipped.m[index]);\r\n }\r\n }\r\n })\r\n\r\n it(\"Flips the handedness of a projection matrix\", () => {\r\n const matrix = new Matrix(sequentialArray);\r\n const flipped = Matrix.FlipProjectionMatrixHand(matrix);\r\n\r\n for (let index = 0; index < 16; index++) {\r\n if (index === 8 || index === 9 || index === 10 || index === 11) {\r\n expect(matrix.m[index]).toEqual(-flipped.m[index]);\r\n } else {\r\n expect(matrix.m[index]).toEqual(flipped.m[index]);\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst identityArray: MatrixArray = [\r\n 1,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n];\r\n\r\nconst zeroArray: MatrixArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\r\n\r\nconst sequentialArray: MatrixArray = [\r\n 1,\r\n 2,\r\n 3,\r\n 4,\r\n 5,\r\n 6,\r\n 7,\r\n 8,\r\n 9,\r\n 10,\r\n 11,\r\n 12,\r\n 13,\r\n 14,\r\n 15,\r\n 16,\r\n];\r\n"]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParametricLine = void 0;
|
|
4
|
-
const Vector3_1 = require("../ValueObjects/Vector3");
|
|
5
|
-
class ParametricLine {
|
|
6
|
-
// See https://planetcalc.com/8253/
|
|
7
|
-
static FromTwoPoint(p1, p2) {
|
|
8
|
-
const dir = Vector3_1.Vector3.Subtract(p2, p1).unit;
|
|
9
|
-
return this.FromPointDirection(p1, dir);
|
|
10
|
-
}
|
|
11
|
-
static FromPointDirection(point, direction) {
|
|
12
|
-
return new ParametricLine({
|
|
13
|
-
x0: point.x,
|
|
14
|
-
y0: point.y,
|
|
15
|
-
z0: point.z,
|
|
16
|
-
a: direction.x,
|
|
17
|
-
b: direction.y,
|
|
18
|
-
c: direction.z,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
static Forward() {
|
|
22
|
-
const p = Vector3_1.Vector3.Zero();
|
|
23
|
-
const d = new Vector3_1.Vector3(0, 0, 1);
|
|
24
|
-
return this.FromPointDirection(p, d);
|
|
25
|
-
}
|
|
26
|
-
static Backward() {
|
|
27
|
-
const p = Vector3_1.Vector3.Zero();
|
|
28
|
-
const d = new Vector3_1.Vector3(0, 0, -1);
|
|
29
|
-
return this.FromPointDirection(p, d);
|
|
30
|
-
}
|
|
31
|
-
static Up() {
|
|
32
|
-
const p = Vector3_1.Vector3.Zero();
|
|
33
|
-
const d = new Vector3_1.Vector3(0, 1, 0);
|
|
34
|
-
return this.FromPointDirection(p, d);
|
|
35
|
-
}
|
|
36
|
-
static Down() {
|
|
37
|
-
const p = Vector3_1.Vector3.Zero();
|
|
38
|
-
const d = new Vector3_1.Vector3(0, -1, 0);
|
|
39
|
-
return this.FromPointDirection(p, d);
|
|
40
|
-
}
|
|
41
|
-
static Left() {
|
|
42
|
-
const p = Vector3_1.Vector3.Zero();
|
|
43
|
-
const d = new Vector3_1.Vector3(-1, 0, 0);
|
|
44
|
-
return this.FromPointDirection(p, d);
|
|
45
|
-
}
|
|
46
|
-
static Right() {
|
|
47
|
-
const p = Vector3_1.Vector3.Zero();
|
|
48
|
-
const d = new Vector3_1.Vector3(1, 0, 0);
|
|
49
|
-
return this.FromPointDirection(p, d);
|
|
50
|
-
}
|
|
51
|
-
static GetPointAtDistance(line, distance) {
|
|
52
|
-
const x = line.x0 + line.a * distance;
|
|
53
|
-
const y = line.y0 + line.b * distance;
|
|
54
|
-
const z = line.z0 + line.c * distance;
|
|
55
|
-
return new Vector3_1.Vector3(x, y, z);
|
|
56
|
-
}
|
|
57
|
-
static GetDistanceToPoint(line, point) {
|
|
58
|
-
return Vector3_1.Vector3.Subtract(line.origin, point).magnitude;
|
|
59
|
-
}
|
|
60
|
-
get origin() {
|
|
61
|
-
return new Vector3_1.Vector3(this.x0, this.y0, this.z0);
|
|
62
|
-
}
|
|
63
|
-
get direction() {
|
|
64
|
-
return new Vector3_1.Vector3(this.a, this.b, this.c);
|
|
65
|
-
}
|
|
66
|
-
constructor(parameters) {
|
|
67
|
-
this.x0 = parameters.x0;
|
|
68
|
-
this.y0 = parameters.y0;
|
|
69
|
-
this.z0 = parameters.z0;
|
|
70
|
-
const dir = new Vector3_1.Vector3(parameters.a, parameters.b, parameters.c).unit;
|
|
71
|
-
this.a = dir.x;
|
|
72
|
-
this.b = dir.y;
|
|
73
|
-
this.c = dir.z;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.ParametricLine = ParametricLine;
|
|
77
|
-
//# sourceMappingURL=ParametricLine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParametricLine.js","sourceRoot":"","sources":["../../../src/ValueObjects/ParametricLine.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAWlD,MAAa,cAAc;IACzB,mCAAmC;IAE5B,MAAM,CAAC,YAAY,CAAC,EAAW,EAAE,EAAW;QACjD,MAAM,GAAG,GAAG,iBAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;QAC1C,OAAO,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,kBAAkB,CAC9B,KAAc,EACd,SAAkB;QAElB,OAAO,IAAI,cAAc,CAAC;YACxB,EAAE,EAAE,KAAK,CAAC,CAAC;YACX,EAAE,EAAE,KAAK,CAAC,CAAC;YACX,EAAE,EAAE,KAAK,CAAC,CAAC;YACX,CAAC,EAAE,SAAS,CAAC,CA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EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QAExB,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEvE,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACjB,CAAC;CACF;AAtGD,wCAsGC","sourcesContent":["import { Vector3 } from \"../ValueObjects/Vector3\";\r\n\r\nexport interface LineParameters {\r\n x0: number;\r\n y0: number;\r\n z0: number;\r\n a: number;\r\n b: number;\r\n c: number;\r\n}\r\n\r\nexport class ParametricLine {\r\n // See https://planetcalc.com/8253/\r\n\r\n public static FromTwoPoint(p1: Vector3, p2: Vector3): ParametricLine {\r\n const dir = Vector3.Subtract(p2, p1).unit;\r\n return this.FromPointDirection(p1, dir);\r\n }\r\n\r\n public static FromPointDirection(\r\n point: Vector3,\r\n direction: Vector3\r\n ): ParametricLine {\r\n return new ParametricLine({\r\n x0: point.x,\r\n y0: point.y,\r\n z0: point.z,\r\n a: direction.x,\r\n b: direction.y,\r\n c: direction.z,\r\n });\r\n }\r\n\r\n public static Forward(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(0, 0, 1);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static Backward(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(0, 0, -1);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static Up(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(0, 1, 0);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static Down(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(0, -1, 0);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static Left(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(-1, 0, 0);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static Right(): ParametricLine {\r\n const p = Vector3.Zero();\r\n const d = new Vector3(1, 0, 0);\r\n return this.FromPointDirection(p, d);\r\n }\r\n\r\n public static GetPointAtDistance(\r\n line: ParametricLine,\r\n distance: number\r\n ): Vector3 {\r\n const x = line.x0 + line.a * distance;\r\n const y = line.y0 + line.b * distance;\r\n const z = line.z0 + line.c * distance;\r\n\r\n return new Vector3(x, y, z);\r\n }\r\n\r\n public static GetDistanceToPoint(\r\n line: ParametricLine,\r\n point: Vector3\r\n ): number {\r\n return Vector3.Subtract(line.origin, point).magnitude;\r\n }\r\n\r\n readonly x0: number;\r\n readonly y0: number;\r\n readonly z0: number;\r\n readonly a: number;\r\n readonly b: number;\r\n readonly c: number;\r\n\r\n get origin(): Vector3 {\r\n return new Vector3(this.x0, this.y0, this.z0);\r\n }\r\n\r\n get direction(): Vector3 {\r\n return new Vector3(this.a, this.b, this.c);\r\n }\r\n\r\n constructor(parameters: LineParameters) {\r\n this.x0 = parameters.x0;\r\n this.y0 = parameters.y0;\r\n this.z0 = parameters.z0;\r\n\r\n const dir = new Vector3(parameters.a, parameters.b, parameters.c).unit;\r\n\r\n this.a = dir.x;\r\n this.b = dir.y;\r\n this.c = dir.z;\r\n }\r\n}\r\n"]}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const _1 = require(".");
|
|
4
|
-
const ParametricLine_1 = require("./ParametricLine");
|
|
5
|
-
test("Setting and getting the parameters", () => {
|
|
6
|
-
const inputParameters = {
|
|
7
|
-
x0: 1,
|
|
8
|
-
y0: 2,
|
|
9
|
-
z0: 3,
|
|
10
|
-
a: 4,
|
|
11
|
-
b: 5,
|
|
12
|
-
c: 6,
|
|
13
|
-
};
|
|
14
|
-
const line = new ParametricLine_1.ParametricLine(inputParameters);
|
|
15
|
-
const dirUnit = new _1.Vector3(4, 5, 6).unit;
|
|
16
|
-
expect(line.x0).toEqual(inputParameters.x0);
|
|
17
|
-
expect(line.y0).toEqual(inputParameters.y0);
|
|
18
|
-
expect(line.z0).toEqual(inputParameters.z0);
|
|
19
|
-
expect(line.a).toBeCloseTo(dirUnit.x);
|
|
20
|
-
expect(line.b).toBeCloseTo(dirUnit.y);
|
|
21
|
-
expect(line.c).toBeCloseTo(dirUnit.z);
|
|
22
|
-
});
|
|
23
|
-
test("Line from point and direction", () => {
|
|
24
|
-
const point = new _1.Vector3(1, 2, 3);
|
|
25
|
-
const dir = new _1.Vector3(10, 20, 30).unit;
|
|
26
|
-
const line = ParametricLine_1.ParametricLine.FromPointDirection(point, dir);
|
|
27
|
-
expect(line.x0).toEqual(1);
|
|
28
|
-
expect(line.y0).toEqual(2);
|
|
29
|
-
expect(line.z0).toEqual(3);
|
|
30
|
-
expect(line.a).toBeCloseTo(dir.x);
|
|
31
|
-
expect(line.b).toBeCloseTo(dir.y);
|
|
32
|
-
expect(line.c).toBeCloseTo(dir.z);
|
|
33
|
-
});
|
|
34
|
-
test("From two points", () => {
|
|
35
|
-
const p1 = new _1.Vector3(1, 2, 3);
|
|
36
|
-
const p2 = new _1.Vector3(4, 5, 6);
|
|
37
|
-
const line = ParametricLine_1.ParametricLine.FromTwoPoint(p1, p2);
|
|
38
|
-
const dir = _1.Vector3.Subtract(p2, p1).unit;
|
|
39
|
-
expect(line.x0).toEqual(1);
|
|
40
|
-
expect(line.y0).toEqual(2);
|
|
41
|
-
expect(line.z0).toEqual(3);
|
|
42
|
-
expect(line.a).toEqual(dir.x);
|
|
43
|
-
expect(line.b).toEqual(dir.y);
|
|
44
|
-
expect(line.c).toEqual(dir.z);
|
|
45
|
-
});
|
|
46
|
-
test("Get point", () => {
|
|
47
|
-
const p1 = new _1.Vector3(1, 2, 3);
|
|
48
|
-
const p2 = new _1.Vector3(4, 5, 6);
|
|
49
|
-
let dir = _1.Vector3.Subtract(p2, p1).unit;
|
|
50
|
-
const distance = 11;
|
|
51
|
-
dir = _1.Vector3.NewVectorOfLength(dir, distance);
|
|
52
|
-
const expectedPoint = _1.Vector3.Add(p1, dir);
|
|
53
|
-
const line = ParametricLine_1.ParametricLine.FromTwoPoint(p1, p2);
|
|
54
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, distance);
|
|
55
|
-
expect(point.array).toEqual(expectedPoint.array);
|
|
56
|
-
});
|
|
57
|
-
test("Get point along forward", () => {
|
|
58
|
-
const line = ParametricLine_1.ParametricLine.Forward();
|
|
59
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
60
|
-
expect(point.array).toEqual([0, 0, 11]);
|
|
61
|
-
});
|
|
62
|
-
test("Get point along backwards", () => {
|
|
63
|
-
const line = ParametricLine_1.ParametricLine.Backward();
|
|
64
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
65
|
-
expect(point.array).toEqual([0, 0, -11]);
|
|
66
|
-
});
|
|
67
|
-
test("Get point along up", () => {
|
|
68
|
-
const line = ParametricLine_1.ParametricLine.Up();
|
|
69
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
70
|
-
expect(point.array).toEqual([0, 11, 0]);
|
|
71
|
-
});
|
|
72
|
-
test("Get point along down", () => {
|
|
73
|
-
const line = ParametricLine_1.ParametricLine.Down();
|
|
74
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
75
|
-
expect(point.array).toEqual([0, -11, 0]);
|
|
76
|
-
});
|
|
77
|
-
test("Get point along left", () => {
|
|
78
|
-
const line = ParametricLine_1.ParametricLine.Left();
|
|
79
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
80
|
-
expect(point.array).toEqual([-11, 0, 0]);
|
|
81
|
-
});
|
|
82
|
-
test("Get point along right", () => {
|
|
83
|
-
const line = ParametricLine_1.ParametricLine.Right();
|
|
84
|
-
const point = ParametricLine_1.ParametricLine.GetPointAtDistance(line, 11);
|
|
85
|
-
expect(point.array).toEqual([11, 0, 0]);
|
|
86
|
-
});
|
|
87
|
-
test("Check for equality", () => {
|
|
88
|
-
const inputParameters = {
|
|
89
|
-
x0: 1,
|
|
90
|
-
y0: 2,
|
|
91
|
-
z0: 3,
|
|
92
|
-
a: 4,
|
|
93
|
-
b: 5,
|
|
94
|
-
c: 6,
|
|
95
|
-
};
|
|
96
|
-
const line1 = new ParametricLine_1.ParametricLine(inputParameters);
|
|
97
|
-
const line2 = new ParametricLine_1.ParametricLine(inputParameters);
|
|
98
|
-
expect(line1).toEqual(line2);
|
|
99
|
-
});
|
|
100
|
-
test("Geting the origin", () => {
|
|
101
|
-
const origin = new _1.Vector3(1, 2, 3);
|
|
102
|
-
const direction = new _1.Vector3(4, 5, 6).unit;
|
|
103
|
-
const line = ParametricLine_1.ParametricLine.FromPointDirection(origin, direction);
|
|
104
|
-
expect(line.origin).toEqual(origin);
|
|
105
|
-
});
|
|
106
|
-
test("Getting the direction", () => {
|
|
107
|
-
const origin = new _1.Vector3(1, 2, 3);
|
|
108
|
-
const direction = new _1.Vector3(4, 5, 6).unit;
|
|
109
|
-
const line = ParametricLine_1.ParametricLine.FromPointDirection(origin, direction);
|
|
110
|
-
expect(_1.Vector3.Close(line.direction, direction)).toEqual(true);
|
|
111
|
-
});
|
|
112
|
-
test("Ensures the direction is unit", () => {
|
|
113
|
-
const origin = new _1.Vector3(1, 2, 3);
|
|
114
|
-
const direction = new _1.Vector3(4, 5, 6);
|
|
115
|
-
const line = ParametricLine_1.ParametricLine.FromPointDirection(origin, direction);
|
|
116
|
-
expect(line.direction).toEqual(direction.unit);
|
|
117
|
-
});
|
|
118
|
-
test("Get distance to point", () => {
|
|
119
|
-
const origin = new _1.Vector3(1, 2, 3);
|
|
120
|
-
const direction = new _1.Vector3(4, 5, 6);
|
|
121
|
-
const line = ParametricLine_1.ParametricLine.FromPointDirection(origin, direction);
|
|
122
|
-
const point = new _1.Vector3(10, 20, 30);
|
|
123
|
-
const expected = _1.Vector3.Subtract(point, origin).magnitude;
|
|
124
|
-
expect(ParametricLine_1.ParametricLine.GetDistanceToPoint(line, point)).toEqual(expected);
|
|
125
|
-
});
|
|
126
|
-
//# sourceMappingURL=ParametricLine.test.js.map
|