@vived/app 2.20.1 → 2.21.2
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/Core/BaseApp/Boundary.d.ts +49 -0
- package/lib/Core/BaseApp/Boundary.js +2 -0
- package/lib/Core/BaseApp/Entity.d.ts +11 -0
- package/lib/Core/BaseApp/Entity.js +2 -0
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.js +12 -0
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.js +10 -0
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.js +10 -0
- package/lib/Core/BaseApp/Errors/index.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/index.js +15 -0
- package/lib/Core/BaseApp/UseCase.d.ts +43 -0
- package/lib/Core/BaseApp/UseCase.js +250 -0
- package/lib/Core/BaseAppState/Boundary.d.ts +14 -0
- package/lib/Core/BaseAppState/Boundary.js +2 -0
- package/lib/Core/BaseAppState/Entity.d.ts +5 -0
- package/lib/Core/BaseAppState/Entity.js +2 -0
- package/lib/Core/BaseAppState/UseCase.d.ts +16 -0
- package/lib/Core/BaseAppState/UseCase.js +54 -0
- package/lib/Core/BaseAppState/UseCase_Imp.d.ts +16 -0
- package/lib/Core/BaseAppState/UseCase_Imp.js +54 -0
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.d.ts +16 -0
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.js +56 -0
- package/lib/Core/DevicePreview/boundary.d.ts +14 -0
- package/lib/Core/DevicePreview/boundary.js +2 -0
- package/lib/Core/DevicePreview/entity.d.ts +5 -0
- package/lib/Core/DevicePreview/entity.js +2 -0
- package/lib/Core/DispatchToHost/Entity.d.ts +4 -0
- package/lib/Core/DispatchToHost/Entity.js +2 -0
- package/lib/Core/DispatchToHost/UseCase.d.ts +12 -0
- package/lib/Core/DispatchToHost/UseCase.js +70 -0
- package/lib/Core/DispatchToHost/boundary.d.ts +9 -0
- package/lib/Core/DispatchToHost/boundary.js +2 -0
- package/lib/Core/Serilization/Boundary.d.ts +20 -0
- package/lib/Core/Serilization/Boundary.js +2 -0
- package/lib/Core/Serilization/Entity.d.ts +3 -0
- package/lib/Core/Serilization/Entity.js +2 -0
- package/lib/Core/Serilization/ErrorDuplicateSystemName.d.ts +3 -0
- package/lib/Core/Serilization/ErrorDuplicateSystemName.js +12 -0
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.d.ts +3 -0
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.js +10 -0
- package/lib/Core/Serilization/Errors.d.ts +6 -0
- package/lib/Core/Serilization/Errors.js +19 -0
- package/lib/Core/Serilization/UseCase.d.ts +10 -0
- package/lib/Core/Serilization/UseCase.js +52 -0
- package/lib/Core/Serilization/UseCase_Imp.d.ts +10 -0
- package/lib/Core/Serilization/UseCase_Imp.js +51 -0
- package/lib/Core/index.d.ts +3 -0
- package/lib/Core/index.js +19 -0
- package/lib/Entities/Color.d.ts +20 -0
- package/lib/Entities/Color.js +59 -0
- package/lib/Entities/LineSegment2D.d.ts +11 -0
- package/lib/Entities/LineSegment2D.js +70 -0
- package/lib/Entities/MouseInput.js +1 -0
- package/lib/Entities/MouseSceneInput.d.ts +15 -0
- package/lib/Entities/MouseSceneInput.js +109 -0
- package/lib/Entities/OrbitCamera.d.ts +76 -0
- package/lib/Entities/OrbitCamera.js +243 -0
- package/lib/Entities/ParametricLine.d.ts +29 -0
- package/lib/Entities/ParametricLine.js +79 -0
- package/lib/Entities/ParametricPlane.d.ts +20 -0
- package/lib/Entities/ParametricPlane.js +63 -0
- 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/Vector2.d.ts +21 -0
- package/lib/Entities/Vector2.js +83 -0
- package/lib/Entities/Vector3.d.ts +19 -0
- package/lib/Entities/Vector3.js +75 -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/Interface/Controllers/appHandler.d.ts +12 -0
- package/lib/Interface/Controllers/appHandler.js +94 -0
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.d.ts +3 -0
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.js +31 -0
- package/lib/Interface/Controllers/dispatchStateChange.d.ts +2 -0
- package/lib/Interface/Controllers/dispatchStateChange.js +10 -0
- package/lib/Interface/Controllers/index.d.ts +9 -0
- package/lib/Interface/Controllers/index.js +21 -0
- package/lib/Interface/Controllers/makeAppHandler.d.ts +12 -0
- package/lib/Interface/Controllers/makeAppHandler.js +96 -0
- package/lib/Interface/Controllers/setDevicePreview.d.ts +2 -0
- package/lib/Interface/Controllers/setDevicePreview.js +14 -0
- package/lib/Interface/Controllers/setIsAuthoring.d.ts +2 -0
- package/lib/Interface/Controllers/setIsAuthoring.js +14 -0
- package/lib/Interface/Controllers/setState.d.ts +2 -0
- package/lib/Interface/Controllers/setState.js +21 -0
- package/lib/Interface/Controllers/showBabylonInspector.d.ts +2 -0
- package/lib/Interface/Controllers/showBabylonInspector.js +9 -0
- package/lib/Interface/Controllers/startApp.d.ts +1 -0
- package/lib/Interface/Controllers/startApp.js +9 -0
- package/lib/Interface/Controllers/stopApp.d.ts +2 -0
- package/lib/Interface/Controllers/stopApp.js +10 -0
- package/lib/Interface/PresentationManagers/DevicePreviewPM.d.ts +13 -0
- package/lib/Interface/PresentationManagers/DevicePreviewPM.js +25 -0
- package/lib/Interface/PresentationManagers/IsAuthoringPM.d.ts +10 -0
- package/lib/Interface/PresentationManagers/IsAuthoringPM.js +23 -0
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.d.ts +10 -0
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.js +23 -0
- package/lib/Interface/PresentationManagers/index.d.ts +3 -0
- package/lib/Interface/PresentationManagers/index.js +15 -0
- package/lib/Interface/appHandler.d.ts +12 -0
- package/lib/Interface/appHandler.js +94 -0
- package/lib/Interface/index.d.ts +2 -0
- package/lib/Interface/index.js +14 -0
- package/lib/PresentationManagers/OrbitCameraPM.d.ts +14 -0
- package/lib/PresentationManagers/OrbitCameraPM.js +31 -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/LerpOrbitCamera.d.ts +36 -0
- package/lib/UseCases/LerpOrbitCamera.js +71 -0
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.d.ts +36 -0
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.js +71 -0
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.d.ts +9 -0
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.js +31 -0
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.d.ts +10 -0
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.js +31 -0
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.d.ts +22 -0
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.js +81 -0
- package/lib/UseCases/OrbitCamera/index.d.ts +4 -0
- package/lib/UseCases/OrbitCamera/index.js +16 -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/SerializeCamera.d.ts +21 -0
- package/lib/UseCases/SerializeCamera.js +59 -0
- package/lib/UseCases/SerializeOrbitCamera.d.ts +21 -0
- package/lib/UseCases/SerializeOrbitCamera.js +59 -0
- package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
- package/lib/UseCases/SerializedCamDemo.js +1 -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
|
@@ -8,33 +8,80 @@ class Vector3 {
|
|
|
8
8
|
this.y = y;
|
|
9
9
|
this.z = z;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a zero vector
|
|
13
|
+
* @returns Vector [0,0,0]
|
|
14
|
+
*/
|
|
11
15
|
static Zero() {
|
|
12
16
|
return new Vector3(0, 0, 0);
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a vector of ones
|
|
20
|
+
* @returns Vector [1,1,1]
|
|
21
|
+
*/
|
|
14
22
|
static One() {
|
|
15
23
|
return new Vector3(1, 1, 1);
|
|
16
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a Right vector (positive X)
|
|
27
|
+
* @param length optional length of the right unit. Default is 1
|
|
28
|
+
* @returns Vector [length, 0,0]
|
|
29
|
+
*/
|
|
17
30
|
static Right(length = 1) {
|
|
18
31
|
return new Vector3(length, 0, 0);
|
|
19
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a Left vector (negative X)
|
|
35
|
+
* @param length optional length of the left unit. Default is 1
|
|
36
|
+
* @returns Vector [-length, 0, 0]
|
|
37
|
+
*/
|
|
20
38
|
static Left(length = 1) {
|
|
21
39
|
return new Vector3(-length, 0, 0);
|
|
22
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates an Up vector (positive Y)
|
|
43
|
+
* @param length optional length of the vector. Default is 1
|
|
44
|
+
* @returns Vector [0, length, 0]
|
|
45
|
+
*/
|
|
23
46
|
static Up(length = 1) {
|
|
24
47
|
return new Vector3(0, length, 0);
|
|
25
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a Down vector (negative Y)
|
|
51
|
+
* @param length optional length of the vector. Default is 1
|
|
52
|
+
* @returns Vector [0, -length, 0]
|
|
53
|
+
*/
|
|
26
54
|
static Down(length = 1) {
|
|
27
55
|
return new Vector3(0, -length, 0);
|
|
28
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a Forward vector (positive Z)
|
|
59
|
+
* @param length optional length of the vector. Default is 1
|
|
60
|
+
* @returns Vector [0, 0, length]
|
|
61
|
+
*/
|
|
29
62
|
static Forward(length = 1) {
|
|
30
63
|
return new Vector3(0, 0, length);
|
|
31
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a Backward vector (negative Z)
|
|
67
|
+
* @param length optional length of the vector. Default is 1
|
|
68
|
+
* @returns Vector [0, 0, -length]
|
|
69
|
+
*/
|
|
32
70
|
static Backward(length = 1) {
|
|
33
71
|
return new Vector3(0, 0, -length);
|
|
34
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a Vector from an array of components
|
|
75
|
+
* @param values The x, y, z components as an array
|
|
76
|
+
* @returns The Vector
|
|
77
|
+
*/
|
|
35
78
|
static FromArray(values) {
|
|
36
79
|
return new Vector3(values[0], values[1], values[2]);
|
|
37
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the magnitude of the Vector3
|
|
83
|
+
* @returns the magnitude of the Vector3
|
|
84
|
+
*/
|
|
38
85
|
get magnitued() {
|
|
39
86
|
const xSqr = this.x * this.x;
|
|
40
87
|
const ySqr = this.y * this.y;
|
|
@@ -42,6 +89,10 @@ class Vector3 {
|
|
|
42
89
|
const magnitude = Math.sqrt(xSqr + ySqr + zSqr);
|
|
43
90
|
return magnitude;
|
|
44
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Gets the unit vector for this Vector3
|
|
94
|
+
* @returns the unit vector
|
|
95
|
+
*/
|
|
45
96
|
get unit() {
|
|
46
97
|
const mag = this.magnitued;
|
|
47
98
|
if (mag === 0) {
|
|
@@ -52,23 +103,52 @@ class Vector3 {
|
|
|
52
103
|
const unitZ = this.z / mag;
|
|
53
104
|
return new Vector3(unitX, unitY, unitZ);
|
|
54
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Gets the vector as an array
|
|
108
|
+
* @returns an array representing the vector
|
|
109
|
+
*/
|
|
55
110
|
get array() {
|
|
56
111
|
return [this.x, this.y, this.z];
|
|
57
112
|
}
|
|
58
113
|
}
|
|
59
114
|
exports.Vector3 = Vector3;
|
|
115
|
+
/**
|
|
116
|
+
* Adds Vector B to Vector A
|
|
117
|
+
* @param a Vector A
|
|
118
|
+
* @param b Vector B
|
|
119
|
+
* @return Result of A + B
|
|
120
|
+
*/
|
|
60
121
|
Vector3.Add = (a, b) => {
|
|
61
122
|
return new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
|
|
62
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* Subtracts Vector B from Vector A
|
|
126
|
+
* @param a Vector A
|
|
127
|
+
* @param b Vector B
|
|
128
|
+
* @return Result of A - B
|
|
129
|
+
*/
|
|
63
130
|
Vector3.Subtract = (a, b) => {
|
|
64
131
|
return new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
65
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Checks to see if the two vectors are equal
|
|
135
|
+
* @param a Vector A
|
|
136
|
+
* @param b Vector B
|
|
137
|
+
* @return True if the two vectors are equal, otherwise false
|
|
138
|
+
*/
|
|
66
139
|
Vector3.Equal = (a, b) => {
|
|
67
140
|
if (a.x === b.x && a.y === b.y && a.z === b.z)
|
|
68
141
|
return true;
|
|
69
142
|
else
|
|
70
143
|
return false;
|
|
71
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Checks to see if the two vectors are close
|
|
147
|
+
* @param a Vector A
|
|
148
|
+
* @param b Vector B
|
|
149
|
+
* @param tolerance Tolerance for checking. Defaulted to 0.01
|
|
150
|
+
* @return True if the distance between the two vectors is less than the tolerance, otherwise false
|
|
151
|
+
*/
|
|
72
152
|
Vector3.Close = (a, b, tolerance = 0.01) => {
|
|
73
153
|
const diff = Vector3.Subtract(a, b);
|
|
74
154
|
const diffMag = diff.magnitued;
|
|
@@ -77,19 +157,55 @@ Vector3.Close = (a, b, tolerance = 0.01) => {
|
|
|
77
157
|
else
|
|
78
158
|
return false;
|
|
79
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* Calculates the Cross Product between two vectors
|
|
162
|
+
* @param a Vector A
|
|
163
|
+
* @param b Vector B
|
|
164
|
+
* @return the cross product between the two vectors
|
|
165
|
+
*/
|
|
80
166
|
Vector3.Cross = (a, b) => {
|
|
81
167
|
const x = a.y * b.z - a.z * b.y;
|
|
82
168
|
const y = a.z * b.x - a.x * b.z;
|
|
83
169
|
const z = a.x * b.y - a.y * b.x;
|
|
84
170
|
return new Vector3(x, y, z);
|
|
85
171
|
};
|
|
172
|
+
/**
|
|
173
|
+
* Calculates the Dot Product between two vectors
|
|
174
|
+
* @param a Vector A
|
|
175
|
+
* @param b Vector B
|
|
176
|
+
* @return the dot product between the two vectors
|
|
177
|
+
*/
|
|
86
178
|
Vector3.Dot = (a, b) => {
|
|
87
179
|
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
88
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* Create a new vector that will have the same unit as the original vector but set to the desired length
|
|
183
|
+
* @param vec The original vector
|
|
184
|
+
* @param length Desired lenght of the final vector
|
|
185
|
+
* @return The resulting vector
|
|
186
|
+
*/
|
|
89
187
|
Vector3.NewVectorOfLength = (vec, length) => {
|
|
90
188
|
const unit = vec.unit;
|
|
91
189
|
return new Vector3(length * unit.x, length * unit.y, length * unit.z);
|
|
92
190
|
};
|
|
191
|
+
Vector3.Transform = (vector, matrix) => {
|
|
192
|
+
const m = matrix.m;
|
|
193
|
+
const rx = vector.x * m[0] + vector.y * m[4] + vector.z * m[8] + m[12];
|
|
194
|
+
const ry = vector.x * m[1] + vector.y * m[5] + vector.z * m[9] + m[13];
|
|
195
|
+
const rz = vector.x * m[2] + vector.y * m[6] + vector.z * m[10] + m[14];
|
|
196
|
+
const rw = 1 / (vector.x * m[3] + vector.y * m[7] + vector.z * m[11] + m[15]);
|
|
197
|
+
const x = rx * rw;
|
|
198
|
+
const y = ry * rw;
|
|
199
|
+
const z = rz * rw;
|
|
200
|
+
return new Vector3(x, y, z);
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Linearly inerpolates between two vectors
|
|
204
|
+
* @param initial The starting point
|
|
205
|
+
* @param final The end point
|
|
206
|
+
* @param percent Percent of the lerp. 0 will return initial and 1 will return final
|
|
207
|
+
* @return the LERP result Vector3
|
|
208
|
+
*/
|
|
93
209
|
Vector3.Lerp = (initial, final, percent) => {
|
|
94
210
|
const x = lerpNumber_1.lerpNumber(initial.x, final.x, percent);
|
|
95
211
|
const y = lerpNumber_1.lerpNumber(initial.y, final.y, percent);
|
|
@@ -18,3 +18,5 @@ __exportStar(require("./Vector3"), exports);
|
|
|
18
18
|
__exportStar(require("./ParametricLine"), exports);
|
|
19
19
|
__exportStar(require("./ParametricPlane"), exports);
|
|
20
20
|
__exportStar(require("./Result"), exports);
|
|
21
|
+
__exportStar(require("./Quaternion"), exports);
|
|
22
|
+
__exportStar(require("./Matrix"), exports);
|