@vived/app 2.29.0 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ValueObjects/Matrix.d.ts +3 -0
- package/lib/ValueObjects/Matrix.js +42 -0
- package/package.json +1 -1
- package/lib/Core/BaseApp/Boundary.d.ts +0 -49
- package/lib/Core/BaseApp/Boundary.js +0 -2
- package/lib/Core/BaseApp/Entity.d.ts +0 -11
- package/lib/Core/BaseApp/Entity.js +0 -2
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.d.ts +0 -3
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.js +0 -12
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.d.ts +0 -3
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.js +0 -10
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.d.ts +0 -3
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.js +0 -10
- package/lib/Core/BaseApp/Errors/index.d.ts +0 -3
- package/lib/Core/BaseApp/Errors/index.js +0 -15
- package/lib/Core/BaseApp/UseCase.d.ts +0 -43
- package/lib/Core/BaseApp/UseCase.js +0 -250
- package/lib/Core/BaseAppState/Boundary.d.ts +0 -14
- package/lib/Core/BaseAppState/Boundary.js +0 -2
- package/lib/Core/BaseAppState/Entity.d.ts +0 -5
- package/lib/Core/BaseAppState/Entity.js +0 -2
- package/lib/Core/BaseAppState/UseCase.d.ts +0 -16
- package/lib/Core/BaseAppState/UseCase.js +0 -54
- package/lib/Core/BaseAppState/UseCase_Imp.d.ts +0 -16
- package/lib/Core/BaseAppState/UseCase_Imp.js +0 -54
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.d.ts +0 -16
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.js +0 -56
- package/lib/Core/DevicePreview/boundary.d.ts +0 -14
- package/lib/Core/DevicePreview/boundary.js +0 -2
- package/lib/Core/DevicePreview/entity.d.ts +0 -5
- package/lib/Core/DevicePreview/entity.js +0 -2
- package/lib/Core/DispatchToHost/Entity.d.ts +0 -4
- package/lib/Core/DispatchToHost/Entity.js +0 -2
- package/lib/Core/DispatchToHost/UseCase.d.ts +0 -12
- package/lib/Core/DispatchToHost/UseCase.js +0 -70
- package/lib/Core/DispatchToHost/boundary.d.ts +0 -9
- package/lib/Core/DispatchToHost/boundary.js +0 -2
- package/lib/Core/Serilization/Boundary.d.ts +0 -20
- package/lib/Core/Serilization/Boundary.js +0 -2
- package/lib/Core/Serilization/Entity.d.ts +0 -3
- package/lib/Core/Serilization/Entity.js +0 -2
- package/lib/Core/Serilization/ErrorDuplicateSystemName.d.ts +0 -3
- package/lib/Core/Serilization/ErrorDuplicateSystemName.js +0 -12
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.d.ts +0 -3
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.js +0 -10
- package/lib/Core/Serilization/Errors.d.ts +0 -6
- package/lib/Core/Serilization/Errors.js +0 -19
- package/lib/Core/Serilization/UseCase.d.ts +0 -10
- package/lib/Core/Serilization/UseCase.js +0 -52
- package/lib/Core/Serilization/UseCase_Imp.d.ts +0 -10
- package/lib/Core/Serilization/UseCase_Imp.js +0 -51
- package/lib/Core/index.d.ts +0 -3
- package/lib/Core/index.js +0 -19
- package/lib/Entities/Color.d.ts +0 -20
- package/lib/Entities/Color.js +0 -59
- package/lib/Entities/FocusCamera.d.ts +0 -70
- package/lib/Entities/FocusCamera.js +0 -272
- package/lib/Entities/LineSegment2D.d.ts +0 -11
- package/lib/Entities/LineSegment2D.js +0 -70
- package/lib/Entities/MouseSceneInput.d.ts +0 -15
- package/lib/Entities/MouseSceneInput.js +0 -109
- package/lib/Entities/OrbitCamera.d.ts +0 -76
- package/lib/Entities/OrbitCamera.js +0 -243
- package/lib/Entities/ParametricLine.d.ts +0 -29
- package/lib/Entities/ParametricLine.js +0 -79
- package/lib/Entities/ParametricPlane.d.ts +0 -20
- package/lib/Entities/ParametricPlane.js +0 -63
- package/lib/Entities/Vector2.d.ts +0 -21
- package/lib/Entities/Vector2.js +0 -83
- package/lib/Entities/Vector3.d.ts +0 -19
- package/lib/Entities/Vector3.js +0 -75
- package/lib/Interface/Controllers/appHandler.d.ts +0 -12
- package/lib/Interface/Controllers/appHandler.js +0 -94
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.d.ts +0 -3
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.js +0 -31
- package/lib/Interface/Controllers/dispatchStateChange.d.ts +0 -2
- package/lib/Interface/Controllers/dispatchStateChange.js +0 -10
- package/lib/Interface/Controllers/index.d.ts +0 -9
- package/lib/Interface/Controllers/index.js +0 -21
- package/lib/Interface/Controllers/makeAppHandler.d.ts +0 -12
- package/lib/Interface/Controllers/makeAppHandler.js +0 -96
- package/lib/Interface/Controllers/setDevicePreview.d.ts +0 -2
- package/lib/Interface/Controllers/setDevicePreview.js +0 -14
- package/lib/Interface/Controllers/setIsAuthoring.d.ts +0 -2
- package/lib/Interface/Controllers/setIsAuthoring.js +0 -14
- package/lib/Interface/Controllers/setState.d.ts +0 -2
- package/lib/Interface/Controllers/setState.js +0 -21
- package/lib/Interface/Controllers/showBabylonInspector.d.ts +0 -2
- package/lib/Interface/Controllers/showBabylonInspector.js +0 -9
- package/lib/Interface/Controllers/startApp.d.ts +0 -1
- package/lib/Interface/Controllers/startApp.js +0 -9
- package/lib/Interface/Controllers/stopApp.d.ts +0 -2
- package/lib/Interface/Controllers/stopApp.js +0 -10
- package/lib/Interface/PresentationManagers/DevicePreviewPM.d.ts +0 -13
- package/lib/Interface/PresentationManagers/DevicePreviewPM.js +0 -25
- package/lib/Interface/PresentationManagers/IsAuthoringPM.d.ts +0 -10
- package/lib/Interface/PresentationManagers/IsAuthoringPM.js +0 -23
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.d.ts +0 -10
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.js +0 -23
- package/lib/Interface/PresentationManagers/index.d.ts +0 -3
- package/lib/Interface/PresentationManagers/index.js +0 -15
- package/lib/Interface/appHandler.d.ts +0 -12
- package/lib/Interface/appHandler.js +0 -94
- package/lib/Interface/index.d.ts +0 -2
- package/lib/Interface/index.js +0 -14
- package/lib/PresentationManagers/FocusCameraPM.d.ts +0 -15
- package/lib/PresentationManagers/FocusCameraPM.js +0 -31
- package/lib/PresentationManagers/FocusCameraPosRotPM.d.ts +0 -13
- package/lib/PresentationManagers/FocusCameraPosRotPM.js +0 -28
- package/lib/PresentationManagers/HoverLabelPM.d.ts +0 -17
- package/lib/PresentationManagers/HoverLabelPM.js +0 -32
- package/lib/PresentationManagers/OrbitCameraPM.d.ts +0 -14
- package/lib/PresentationManagers/OrbitCameraPM.js +0 -31
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +0 -17
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +0 -64
- package/lib/UseCases/FocusCamera/LerpFocusCamera.d.ts +0 -36
- package/lib/UseCases/FocusCamera/LerpFocusCamera.js +0 -71
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +0 -36
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +0 -36
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +0 -26
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +0 -33
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.d.ts +0 -22
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +0 -81
- package/lib/UseCases/FocusCamera/index.d.ts +0 -7
- package/lib/UseCases/FocusCamera/index.js +0 -19
- package/lib/UseCases/LerpOrbitCamera.d.ts +0 -36
- package/lib/UseCases/LerpOrbitCamera.js +0 -71
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.d.ts +0 -36
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.js +0 -71
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.d.ts +0 -9
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.js +0 -31
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.d.ts +0 -10
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.js +0 -31
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.d.ts +0 -22
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.js +0 -81
- package/lib/UseCases/OrbitCamera/index.d.ts +0 -4
- package/lib/UseCases/OrbitCamera/index.js +0 -16
- package/lib/UseCases/SerializeCamera.d.ts +0 -21
- package/lib/UseCases/SerializeCamera.js +0 -59
- package/lib/UseCases/SerializeOrbitCamera.d.ts +0 -21
- package/lib/UseCases/SerializeOrbitCamera.js +0 -59
- package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
- package/lib/UseCases/SerializedCamDemo.js +0 -1
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeOrbitCamera = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
function makeOrbitCamera() {
|
|
6
|
-
return new OrbitCameraImp();
|
|
7
|
-
}
|
|
8
|
-
exports.makeOrbitCamera = makeOrbitCamera;
|
|
9
|
-
class OrbitCameraImp {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.farClip = 100;
|
|
12
|
-
this.nearClip = 0.01;
|
|
13
|
-
this.defaultAlpha = 0;
|
|
14
|
-
this.defaultBeta = 30;
|
|
15
|
-
this.defaultRadius = 8;
|
|
16
|
-
this.defaultTarget = _1.Vector3.Zero();
|
|
17
|
-
this.orbitPixelSensitivity = 0.5;
|
|
18
|
-
this.dollyPixelSensitivity = 0.01;
|
|
19
|
-
this.dollyRollSensitivity = 0.001;
|
|
20
|
-
this.dollyPinchSensitivity = 0.005;
|
|
21
|
-
this.limitRadius = false;
|
|
22
|
-
this.minRadius = 0;
|
|
23
|
-
this.maxRadius = 0;
|
|
24
|
-
this.limitAlpha = false;
|
|
25
|
-
this.minAlpha = 0;
|
|
26
|
-
this.maxAlpha = 0;
|
|
27
|
-
this.limitBeta = false;
|
|
28
|
-
this.minBeta = 0;
|
|
29
|
-
this.maxBeta = 0;
|
|
30
|
-
this.limitTarget = false;
|
|
31
|
-
this.maxTargetPosition = _1.Vector3.Zero();
|
|
32
|
-
this.minTargetPosition = _1.Vector3.Zero();
|
|
33
|
-
this.observers = new _1.ObserverList();
|
|
34
|
-
this.memoizedAlpha = new _1.MemoizedNumber(0, this.observers.notify);
|
|
35
|
-
this.memoizedBeta = new _1.MemoizedNumber(0, this.observers.notify);
|
|
36
|
-
this.memoizedRadius = new _1.MemoizedNumber(1, this.observers.notify);
|
|
37
|
-
this.memoizedTarget = new _1.MemoizedVector3(_1.Vector3.Zero(), this.observers.notify);
|
|
38
|
-
this.setRadiusLimits = (min, max) => {
|
|
39
|
-
if (min < 0) {
|
|
40
|
-
throw new Error("[Orbit Camera] Mininum Radius must be greater >= 0");
|
|
41
|
-
}
|
|
42
|
-
if (max < min) {
|
|
43
|
-
throw new Error("[Orbit Camera] Max radius must be >= min radius");
|
|
44
|
-
}
|
|
45
|
-
this.maxRadius = max;
|
|
46
|
-
this.minRadius = min;
|
|
47
|
-
this.limitRadius = true;
|
|
48
|
-
this.radius = this.radius;
|
|
49
|
-
};
|
|
50
|
-
this.clearRadiusLimits = () => {
|
|
51
|
-
this.maxRadius = 0;
|
|
52
|
-
this.minRadius = 0;
|
|
53
|
-
this.limitRadius = false;
|
|
54
|
-
};
|
|
55
|
-
this.setAlphaLimits = (min, max) => {
|
|
56
|
-
if (min > max) {
|
|
57
|
-
throw new Error("[Orbit Camera] Max alpha must be >= min alpha");
|
|
58
|
-
}
|
|
59
|
-
if (min < -180) {
|
|
60
|
-
throw new Error("[Orbit Camera] Min alpha must be >= -180");
|
|
61
|
-
}
|
|
62
|
-
if (max > 180) {
|
|
63
|
-
throw new Error("[Orbit Camera] Max alpha must be <= 180");
|
|
64
|
-
}
|
|
65
|
-
this.maxAlpha = max;
|
|
66
|
-
this.minAlpha = min;
|
|
67
|
-
this.limitAlpha = true;
|
|
68
|
-
this.alpha = this.alpha;
|
|
69
|
-
};
|
|
70
|
-
this.clearAlphaLimits = () => {
|
|
71
|
-
this.maxAlpha = 0;
|
|
72
|
-
this.minAlpha = 0;
|
|
73
|
-
this.limitAlpha = false;
|
|
74
|
-
};
|
|
75
|
-
this.setBetaLimits = (min, max) => {
|
|
76
|
-
if (min > max) {
|
|
77
|
-
throw new Error("[Orbit Camera] Max beta must be >= min beta");
|
|
78
|
-
}
|
|
79
|
-
if (min < -180) {
|
|
80
|
-
throw new Error("[Orbit Camera] Min beta must be >= -180");
|
|
81
|
-
}
|
|
82
|
-
if (max > 180) {
|
|
83
|
-
throw new Error("[Orbit Camera] Max beta must be <= 180");
|
|
84
|
-
}
|
|
85
|
-
this.maxBeta = max;
|
|
86
|
-
this.minBeta = min;
|
|
87
|
-
this.limitBeta = true;
|
|
88
|
-
this.beta = this.beta;
|
|
89
|
-
};
|
|
90
|
-
this.clearBetaLimits = () => {
|
|
91
|
-
this.maxBeta = 0;
|
|
92
|
-
this.minBeta = 0;
|
|
93
|
-
this.limitBeta = false;
|
|
94
|
-
};
|
|
95
|
-
this.setTargetLimits = (min, max) => {
|
|
96
|
-
const minArray = min.asArray();
|
|
97
|
-
const maxArray = max.asArray();
|
|
98
|
-
for (let i = 0; i < 3; i++) {
|
|
99
|
-
if (minArray[i] > maxArray[i]) {
|
|
100
|
-
throw new Error("[Orbit Camera] Min target must be less than the max target");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
this.maxTargetPosition = max;
|
|
104
|
-
this.minTargetPosition = min;
|
|
105
|
-
this.limitTarget = true;
|
|
106
|
-
this.target = this.target;
|
|
107
|
-
};
|
|
108
|
-
this.clearTargetLimits = () => {
|
|
109
|
-
this.maxTargetPosition = _1.Vector3.Zero();
|
|
110
|
-
this.minTargetPosition = _1.Vector3.Zero();
|
|
111
|
-
this.limitTarget = false;
|
|
112
|
-
};
|
|
113
|
-
this.registerLerp = (lerper) => {
|
|
114
|
-
if (this.currentLerp) {
|
|
115
|
-
this.currentLerp.cancelLerp();
|
|
116
|
-
}
|
|
117
|
-
this.currentLerp = lerper;
|
|
118
|
-
};
|
|
119
|
-
this.lerpCompleted = () => {
|
|
120
|
-
this.currentLerp = undefined;
|
|
121
|
-
};
|
|
122
|
-
this.cancelLerp = () => {
|
|
123
|
-
var _a;
|
|
124
|
-
(_a = this.currentLerp) === null || _a === void 0 ? void 0 : _a.cancelLerp();
|
|
125
|
-
this.currentLerp = undefined;
|
|
126
|
-
};
|
|
127
|
-
this.applyData = (data) => {
|
|
128
|
-
if (data.defaultAlpha !== undefined) {
|
|
129
|
-
this.defaultAlpha = data.defaultAlpha;
|
|
130
|
-
}
|
|
131
|
-
if (data.defaultBeta !== undefined) {
|
|
132
|
-
this.defaultBeta = data.defaultBeta;
|
|
133
|
-
}
|
|
134
|
-
if (data.defaultRadius !== undefined) {
|
|
135
|
-
this.defaultRadius = data.defaultRadius;
|
|
136
|
-
}
|
|
137
|
-
if (data.defaultTarget !== undefined) {
|
|
138
|
-
const { x, y, z } = data.defaultTarget;
|
|
139
|
-
this.defaultTarget = new _1.Vector3(x, y, z);
|
|
140
|
-
}
|
|
141
|
-
if (data.nearClip !== undefined) {
|
|
142
|
-
this.nearClip = data.nearClip;
|
|
143
|
-
}
|
|
144
|
-
if (data.farClip !== undefined) {
|
|
145
|
-
this.farClip = data.farClip;
|
|
146
|
-
}
|
|
147
|
-
if (data.alphaLimit !== undefined) {
|
|
148
|
-
this.setAlphaLimits(data.alphaLimit.min, data.alphaLimit.max);
|
|
149
|
-
}
|
|
150
|
-
if (data.betaLimit !== undefined) {
|
|
151
|
-
this.setBetaLimits(data.betaLimit.min, data.betaLimit.max);
|
|
152
|
-
}
|
|
153
|
-
if (data.radiusLimit !== undefined) {
|
|
154
|
-
this.setRadiusLimits(data.radiusLimit.min, data.radiusLimit.max);
|
|
155
|
-
}
|
|
156
|
-
if (data.targetLimit !== undefined) {
|
|
157
|
-
const { max, min } = data.targetLimit;
|
|
158
|
-
this.setTargetLimits(new _1.Vector3(min.x, min.y, min.z), new _1.Vector3(max.x, max.y, max.z));
|
|
159
|
-
}
|
|
160
|
-
if (data.dollyRollSensitivity !== undefined) {
|
|
161
|
-
this.dollyRollSensitivity = data.dollyRollSensitivity;
|
|
162
|
-
}
|
|
163
|
-
if (data.dollyPixelSensitivity !== undefined) {
|
|
164
|
-
this.dollyPixelSensitivity = data.dollyPixelSensitivity;
|
|
165
|
-
}
|
|
166
|
-
if (data.dollyPinchSensitivity !== undefined) {
|
|
167
|
-
this.dollyPinchSensitivity = data.dollyPinchSensitivity;
|
|
168
|
-
}
|
|
169
|
-
if (data.orbitPixelSensitivity !== undefined) {
|
|
170
|
-
this.orbitPixelSensitivity = data.orbitPixelSensitivity;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
this.addObserver = (observer) => {
|
|
174
|
-
this.observers.add(observer);
|
|
175
|
-
};
|
|
176
|
-
this.removeObserver = (observer) => {
|
|
177
|
-
this.observers.remove(observer);
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
get alpha() {
|
|
181
|
-
return this.memoizedAlpha.val;
|
|
182
|
-
}
|
|
183
|
-
set alpha(val) {
|
|
184
|
-
let clampedVal = this.clampAngle(val);
|
|
185
|
-
if (this.limitAlpha) {
|
|
186
|
-
clampedVal = Math.min(clampedVal, this.maxAlpha);
|
|
187
|
-
clampedVal = Math.max(clampedVal, this.minAlpha);
|
|
188
|
-
}
|
|
189
|
-
this.memoizedAlpha.val = clampedVal;
|
|
190
|
-
}
|
|
191
|
-
get beta() {
|
|
192
|
-
return this.memoizedBeta.val;
|
|
193
|
-
}
|
|
194
|
-
set beta(val) {
|
|
195
|
-
let clampedVal = this.clampAngle(val);
|
|
196
|
-
if (this.limitBeta) {
|
|
197
|
-
clampedVal = Math.min(clampedVal, this.maxBeta);
|
|
198
|
-
clampedVal = Math.max(clampedVal, this.minBeta);
|
|
199
|
-
}
|
|
200
|
-
this.memoizedBeta.val = clampedVal;
|
|
201
|
-
}
|
|
202
|
-
get radius() {
|
|
203
|
-
return this.memoizedRadius.val;
|
|
204
|
-
}
|
|
205
|
-
set radius(val) {
|
|
206
|
-
let clampedVal = Math.max(val, 0);
|
|
207
|
-
if (this.limitRadius) {
|
|
208
|
-
clampedVal = Math.min(clampedVal, this.maxRadius);
|
|
209
|
-
clampedVal = Math.max(clampedVal, this.minRadius);
|
|
210
|
-
}
|
|
211
|
-
this.memoizedRadius.val = clampedVal;
|
|
212
|
-
}
|
|
213
|
-
get target() {
|
|
214
|
-
return this.memoizedTarget.getVector();
|
|
215
|
-
}
|
|
216
|
-
set target(val) {
|
|
217
|
-
const targetVals = val.asArray();
|
|
218
|
-
if (this.limitTarget) {
|
|
219
|
-
const maxVals = this.maxTargetPosition.asArray();
|
|
220
|
-
const minVals = this.minTargetPosition.asArray();
|
|
221
|
-
for (let i = 0; i < 3; i++) {
|
|
222
|
-
let v = targetVals[i];
|
|
223
|
-
v = Math.min(v, maxVals[i]);
|
|
224
|
-
v = Math.max(v, minVals[i]);
|
|
225
|
-
targetVals[i] = v;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
this.memoizedTarget.setVector(new _1.Vector3(targetVals[0], targetVals[1], targetVals[2]));
|
|
229
|
-
}
|
|
230
|
-
clampAngle(angle) {
|
|
231
|
-
const isNegative = angle < 0 ? true : false;
|
|
232
|
-
const absAngle = Math.abs(angle);
|
|
233
|
-
const revolutions = Math.floor(absAngle / 360);
|
|
234
|
-
let angleWithoutRevolutions = absAngle - revolutions * 360;
|
|
235
|
-
if (angleWithoutRevolutions > 180) {
|
|
236
|
-
angleWithoutRevolutions = angleWithoutRevolutions - 360;
|
|
237
|
-
}
|
|
238
|
-
if (isNegative) {
|
|
239
|
-
angleWithoutRevolutions *= -1;
|
|
240
|
-
}
|
|
241
|
-
return angleWithoutRevolutions;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Vector3 } from "../ValueObjects/Vector3";
|
|
2
|
-
export interface LineParameters {
|
|
3
|
-
x0: number;
|
|
4
|
-
y0: number;
|
|
5
|
-
z0: number;
|
|
6
|
-
a: number;
|
|
7
|
-
b: number;
|
|
8
|
-
c: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class ParametricLine {
|
|
11
|
-
private x0;
|
|
12
|
-
private y0;
|
|
13
|
-
private z0;
|
|
14
|
-
private a;
|
|
15
|
-
private b;
|
|
16
|
-
private c;
|
|
17
|
-
static FromTwoPoint(p1: Vector3, p2: Vector3): ParametricLine;
|
|
18
|
-
static FromPointDirection(point: Vector3, direction: Vector3): ParametricLine;
|
|
19
|
-
static Forward(): ParametricLine;
|
|
20
|
-
static Backward(): ParametricLine;
|
|
21
|
-
static Up(): ParametricLine;
|
|
22
|
-
static Down(): ParametricLine;
|
|
23
|
-
static Left(): ParametricLine;
|
|
24
|
-
static Right(): ParametricLine;
|
|
25
|
-
getPointAtDistance(distance: number): Vector3;
|
|
26
|
-
getParameters(): LineParameters;
|
|
27
|
-
copy(): ParametricLine;
|
|
28
|
-
constructor(parameters: LineParameters);
|
|
29
|
-
}
|
|
@@ -1,79 +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
|
-
constructor(parameters) {
|
|
7
|
-
this.x0 = parameters.x0;
|
|
8
|
-
this.y0 = parameters.y0;
|
|
9
|
-
this.z0 = parameters.z0;
|
|
10
|
-
this.a = parameters.a;
|
|
11
|
-
this.b = parameters.b;
|
|
12
|
-
this.c = parameters.c;
|
|
13
|
-
}
|
|
14
|
-
static FromTwoPoint(p1, p2) {
|
|
15
|
-
const dir = Vector3_1.Vector3.subtract(p2, p1).unit;
|
|
16
|
-
return this.FromPointDirection(p1, dir);
|
|
17
|
-
}
|
|
18
|
-
static FromPointDirection(point, direction) {
|
|
19
|
-
return new ParametricLine({
|
|
20
|
-
x0: point.x,
|
|
21
|
-
y0: point.y,
|
|
22
|
-
z0: point.z,
|
|
23
|
-
a: direction.x,
|
|
24
|
-
b: direction.y,
|
|
25
|
-
c: direction.z,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
static Forward() {
|
|
29
|
-
const p = Vector3_1.Vector3.zero();
|
|
30
|
-
const d = new Vector3_1.Vector3(0, 0, 1);
|
|
31
|
-
return this.FromPointDirection(p, d);
|
|
32
|
-
}
|
|
33
|
-
static Backward() {
|
|
34
|
-
const p = Vector3_1.Vector3.zero();
|
|
35
|
-
const d = new Vector3_1.Vector3(0, 0, -1);
|
|
36
|
-
return this.FromPointDirection(p, d);
|
|
37
|
-
}
|
|
38
|
-
static Up() {
|
|
39
|
-
const p = Vector3_1.Vector3.zero();
|
|
40
|
-
const d = new Vector3_1.Vector3(0, 1, 0);
|
|
41
|
-
return this.FromPointDirection(p, d);
|
|
42
|
-
}
|
|
43
|
-
static Down() {
|
|
44
|
-
const p = Vector3_1.Vector3.zero();
|
|
45
|
-
const d = new Vector3_1.Vector3(0, -1, 0);
|
|
46
|
-
return this.FromPointDirection(p, d);
|
|
47
|
-
}
|
|
48
|
-
static Left() {
|
|
49
|
-
const p = Vector3_1.Vector3.zero();
|
|
50
|
-
const d = new Vector3_1.Vector3(-1, 0, 0);
|
|
51
|
-
return this.FromPointDirection(p, d);
|
|
52
|
-
}
|
|
53
|
-
static Right() {
|
|
54
|
-
const p = Vector3_1.Vector3.zero();
|
|
55
|
-
const d = new Vector3_1.Vector3(1, 0, 0);
|
|
56
|
-
return this.FromPointDirection(p, d);
|
|
57
|
-
}
|
|
58
|
-
getPointAtDistance(distance) {
|
|
59
|
-
const x = this.x0 + this.a * distance;
|
|
60
|
-
const y = this.y0 + this.b * distance;
|
|
61
|
-
const z = this.z0 + this.c * distance;
|
|
62
|
-
return new Vector3_1.Vector3(x, y, z);
|
|
63
|
-
}
|
|
64
|
-
getParameters() {
|
|
65
|
-
return {
|
|
66
|
-
x0: this.x0,
|
|
67
|
-
y0: this.y0,
|
|
68
|
-
z0: this.z0,
|
|
69
|
-
a: this.a,
|
|
70
|
-
b: this.b,
|
|
71
|
-
c: this.c,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
copy() {
|
|
75
|
-
const parameters = this.getParameters();
|
|
76
|
-
return new ParametricLine(parameters);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.ParametricLine = ParametricLine;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ParametricLine } from "./ParametricLine";
|
|
2
|
-
import { Vector3 } from "../ValueObjects/Vector3";
|
|
3
|
-
export interface PlaneParameters {
|
|
4
|
-
a: number;
|
|
5
|
-
b: number;
|
|
6
|
-
c: number;
|
|
7
|
-
d: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class ParametricPlane {
|
|
10
|
-
private point;
|
|
11
|
-
private normal;
|
|
12
|
-
static FromPointNormal(point: Vector3, normal: Vector3): ParametricPlane;
|
|
13
|
-
static FromThreePoints(A: Vector3, B: Vector3, C: Vector3): ParametricPlane;
|
|
14
|
-
static XY(): ParametricPlane;
|
|
15
|
-
static ZX(): ParametricPlane;
|
|
16
|
-
static YZ(): ParametricPlane;
|
|
17
|
-
getParameters(): PlaneParameters;
|
|
18
|
-
intersectLine(line: ParametricLine): Vector3 | undefined;
|
|
19
|
-
constructor(point: Vector3, normal: Vector3);
|
|
20
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParametricPlane = void 0;
|
|
4
|
-
const Vector3_1 = require("../ValueObjects/Vector3");
|
|
5
|
-
class ParametricPlane {
|
|
6
|
-
constructor(point, normal) {
|
|
7
|
-
this.point = point;
|
|
8
|
-
this.normal = normal;
|
|
9
|
-
}
|
|
10
|
-
static FromPointNormal(point, normal) {
|
|
11
|
-
return new ParametricPlane(point, normal);
|
|
12
|
-
}
|
|
13
|
-
static FromThreePoints(A, B, C) {
|
|
14
|
-
const point = A;
|
|
15
|
-
const AB = Vector3_1.Vector3.subtract(B, A);
|
|
16
|
-
const AC = Vector3_1.Vector3.subtract(C, A);
|
|
17
|
-
const normal = Vector3_1.Vector3.cross(AB, AC);
|
|
18
|
-
return new ParametricPlane(point, normal);
|
|
19
|
-
}
|
|
20
|
-
static XY() {
|
|
21
|
-
const p = Vector3_1.Vector3.zero();
|
|
22
|
-
const n = new Vector3_1.Vector3(0, 0, 1);
|
|
23
|
-
return new ParametricPlane(p, n);
|
|
24
|
-
}
|
|
25
|
-
static ZX() {
|
|
26
|
-
const p = Vector3_1.Vector3.zero();
|
|
27
|
-
const n = new Vector3_1.Vector3(0, 1, 0);
|
|
28
|
-
return new ParametricPlane(p, n);
|
|
29
|
-
}
|
|
30
|
-
static YZ() {
|
|
31
|
-
const p = Vector3_1.Vector3.zero();
|
|
32
|
-
const n = new Vector3_1.Vector3(1, 0, 0);
|
|
33
|
-
return new ParametricPlane(p, n);
|
|
34
|
-
}
|
|
35
|
-
getParameters() {
|
|
36
|
-
const a = this.normal.x;
|
|
37
|
-
const b = this.normal.y;
|
|
38
|
-
const c = this.normal.z;
|
|
39
|
-
let d = Vector3_1.Vector3.dot(this.point, this.normal);
|
|
40
|
-
if (d !== 0) {
|
|
41
|
-
d *= -1;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
a,
|
|
45
|
-
b,
|
|
46
|
-
c,
|
|
47
|
-
d,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
intersectLine(line) {
|
|
51
|
-
const { x0, y0, z0, a, b, c } = line.getParameters();
|
|
52
|
-
const { a: A, b: B, c: C, d: D } = this.getParameters();
|
|
53
|
-
const tNumerator = -(A * x0 + B * y0 + C * z0 + D);
|
|
54
|
-
const tDenominator = A * a + B * b + C * c;
|
|
55
|
-
if (tDenominator === 0) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const t = tNumerator / tDenominator;
|
|
59
|
-
const intersect = line.getPointAtDistance(t);
|
|
60
|
-
return intersect;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.ParametricPlane = ParametricPlane;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare class Vector2 {
|
|
2
|
-
static Zero(): Vector2;
|
|
3
|
-
static One(): Vector2;
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
get magnitued(): number;
|
|
7
|
-
get unit(): Vector2;
|
|
8
|
-
get theta(): number;
|
|
9
|
-
setLength: (length: number) => void;
|
|
10
|
-
add: (vector2: Vector2) => Vector2;
|
|
11
|
-
subtract: (vector2: Vector2) => Vector2;
|
|
12
|
-
equal: (a: Vector2) => boolean;
|
|
13
|
-
close: (vec: Vector2) => boolean;
|
|
14
|
-
copy: () => Vector2;
|
|
15
|
-
asArray: () => [number, number];
|
|
16
|
-
rotate: (theta: number) => Vector2;
|
|
17
|
-
dot: (vec: Vector2) => number;
|
|
18
|
-
angleTo: (vec: Vector2) => number;
|
|
19
|
-
cross: (vec: Vector2) => number;
|
|
20
|
-
constructor(x: number, y: number);
|
|
21
|
-
}
|
package/lib/Entities/Vector2.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Vector2 = void 0;
|
|
4
|
-
class Vector2 {
|
|
5
|
-
constructor(x, y) {
|
|
6
|
-
this.setLength = (length) => {
|
|
7
|
-
const unit = this.unit;
|
|
8
|
-
this.x = length * unit.x;
|
|
9
|
-
this.y = length * unit.y;
|
|
10
|
-
};
|
|
11
|
-
this.add = (vector2) => {
|
|
12
|
-
return new Vector2(this.x + vector2.x, this.y + vector2.y);
|
|
13
|
-
};
|
|
14
|
-
this.subtract = (vector2) => {
|
|
15
|
-
return new Vector2(this.x - vector2.x, this.y - vector2.y);
|
|
16
|
-
};
|
|
17
|
-
this.equal = (a) => {
|
|
18
|
-
if (a.x === this.x && a.y === this.y)
|
|
19
|
-
return true;
|
|
20
|
-
else
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
this.close = (vec) => {
|
|
24
|
-
const diff = this.subtract(vec);
|
|
25
|
-
const diffMag = diff.magnitued;
|
|
26
|
-
if (diffMag < 0.01)
|
|
27
|
-
return true;
|
|
28
|
-
else
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
31
|
-
this.copy = () => {
|
|
32
|
-
return new Vector2(this.x, this.y);
|
|
33
|
-
};
|
|
34
|
-
this.asArray = () => {
|
|
35
|
-
return [this.x, this.y];
|
|
36
|
-
};
|
|
37
|
-
this.rotate = (theta) => {
|
|
38
|
-
const thetaRadians = theta * Math.PI / 180;
|
|
39
|
-
const x = this.x * Math.cos(thetaRadians) - this.y * Math.sin(thetaRadians);
|
|
40
|
-
const y = this.x * Math.sin(thetaRadians) + this.y * Math.cos(thetaRadians);
|
|
41
|
-
return new Vector2(x, y);
|
|
42
|
-
};
|
|
43
|
-
this.dot = (vec) => {
|
|
44
|
-
return this.x * vec.x + this.y * vec.y;
|
|
45
|
-
};
|
|
46
|
-
this.angleTo = (vec) => {
|
|
47
|
-
const dot = this.dot(vec);
|
|
48
|
-
const magnitues = vec.magnitued * this.magnitued;
|
|
49
|
-
const angRadians = Math.acos(dot / magnitues);
|
|
50
|
-
return angRadians * 180 / Math.PI;
|
|
51
|
-
};
|
|
52
|
-
this.cross = (vec) => {
|
|
53
|
-
return (this.x * vec.y) - (this.y * vec.x);
|
|
54
|
-
};
|
|
55
|
-
this.x = x;
|
|
56
|
-
this.y = y;
|
|
57
|
-
}
|
|
58
|
-
static Zero() {
|
|
59
|
-
return new Vector2(0, 0);
|
|
60
|
-
}
|
|
61
|
-
static One() {
|
|
62
|
-
return new Vector2(1, 1);
|
|
63
|
-
}
|
|
64
|
-
get magnitued() {
|
|
65
|
-
const xSqr = this.x * this.x;
|
|
66
|
-
const ySqr = this.y * this.y;
|
|
67
|
-
const magnitude = Math.sqrt(xSqr + ySqr);
|
|
68
|
-
return magnitude;
|
|
69
|
-
}
|
|
70
|
-
get unit() {
|
|
71
|
-
const mag = this.magnitued;
|
|
72
|
-
if (mag === 0) {
|
|
73
|
-
return Vector2.Zero();
|
|
74
|
-
}
|
|
75
|
-
const unitX = this.x / mag;
|
|
76
|
-
const unitY = this.y / mag;
|
|
77
|
-
return new Vector2(unitX, unitY);
|
|
78
|
-
}
|
|
79
|
-
get theta() {
|
|
80
|
-
return (Math.atan2(this.y, this.x) * 180) / Math.PI;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.Vector2 = Vector2;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class Vector3 {
|
|
2
|
-
static Zero(): Vector3;
|
|
3
|
-
static One(): Vector3;
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
z: number;
|
|
7
|
-
get magnitued(): number;
|
|
8
|
-
get unit(): Vector3;
|
|
9
|
-
setLength: (length: number) => void;
|
|
10
|
-
add: (a: Vector3) => Vector3;
|
|
11
|
-
subtract: (vector2: Vector3) => Vector3;
|
|
12
|
-
copy: () => Vector3;
|
|
13
|
-
equals: (vec: Vector3) => boolean;
|
|
14
|
-
close: (vec: Vector3) => boolean;
|
|
15
|
-
cross: (vec: Vector3) => Vector3;
|
|
16
|
-
dot: (vec: Vector3) => number;
|
|
17
|
-
asArray: () => [number, number, number];
|
|
18
|
-
constructor(x: number, y: number, z: number);
|
|
19
|
-
}
|
package/lib/Entities/Vector3.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Vector3 = void 0;
|
|
4
|
-
class Vector3 {
|
|
5
|
-
constructor(x, y, z) {
|
|
6
|
-
this.setLength = (length) => {
|
|
7
|
-
const unit = this.unit;
|
|
8
|
-
this.x = length * unit.x;
|
|
9
|
-
this.y = length * unit.y;
|
|
10
|
-
this.z = length * unit.z;
|
|
11
|
-
};
|
|
12
|
-
this.add = (a) => {
|
|
13
|
-
return new Vector3(this.x + a.x, this.y + a.y, this.z + a.z);
|
|
14
|
-
};
|
|
15
|
-
this.subtract = (vector2) => {
|
|
16
|
-
return new Vector3(this.x - vector2.x, this.y - vector2.y, this.z - vector2.z);
|
|
17
|
-
};
|
|
18
|
-
this.copy = () => {
|
|
19
|
-
return new Vector3(this.x, this.y, this.z);
|
|
20
|
-
};
|
|
21
|
-
this.equals = (vec) => {
|
|
22
|
-
if (vec.x === this.x && vec.y === this.y && vec.z === this.z)
|
|
23
|
-
return true;
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
};
|
|
27
|
-
this.close = (vec) => {
|
|
28
|
-
const diff = this.subtract(vec);
|
|
29
|
-
const diffMag = diff.magnitued;
|
|
30
|
-
if (diffMag < 0.01)
|
|
31
|
-
return true;
|
|
32
|
-
else
|
|
33
|
-
return false;
|
|
34
|
-
};
|
|
35
|
-
this.cross = (vec) => {
|
|
36
|
-
const x = this.y * vec.z - this.z * vec.y;
|
|
37
|
-
const y = this.z * vec.x - this.x * vec.z;
|
|
38
|
-
const z = this.x * vec.y - this.y * vec.x;
|
|
39
|
-
return new Vector3(x, y, z);
|
|
40
|
-
};
|
|
41
|
-
this.dot = (vec) => {
|
|
42
|
-
return this.x * vec.x + this.y * vec.y + this.z * vec.z;
|
|
43
|
-
};
|
|
44
|
-
this.asArray = () => {
|
|
45
|
-
return [this.x, this.y, this.z];
|
|
46
|
-
};
|
|
47
|
-
this.x = x;
|
|
48
|
-
this.y = y;
|
|
49
|
-
this.z = z;
|
|
50
|
-
}
|
|
51
|
-
static Zero() {
|
|
52
|
-
return new Vector3(0, 0, 0);
|
|
53
|
-
}
|
|
54
|
-
static One() {
|
|
55
|
-
return new Vector3(1, 1, 1);
|
|
56
|
-
}
|
|
57
|
-
get magnitued() {
|
|
58
|
-
const xSqr = this.x * this.x;
|
|
59
|
-
const ySqr = this.y * this.y;
|
|
60
|
-
const zSqr = this.z * this.z;
|
|
61
|
-
const magnitude = Math.sqrt(xSqr + ySqr + zSqr);
|
|
62
|
-
return magnitude;
|
|
63
|
-
}
|
|
64
|
-
get unit() {
|
|
65
|
-
const mag = this.magnitued;
|
|
66
|
-
if (mag === 0) {
|
|
67
|
-
return Vector3.Zero();
|
|
68
|
-
}
|
|
69
|
-
const unitX = this.x / mag;
|
|
70
|
-
const unitY = this.y / mag;
|
|
71
|
-
const unitZ = this.z / mag;
|
|
72
|
-
return new Vector3(unitX, unitY, unitZ);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.Vector3 = Vector3;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AppPayloadVersions, Handler } from "@vived/app-host-boundary";
|
|
2
|
-
export declare const appPayloadVersions: AppPayloadVersions;
|
|
3
|
-
export interface AppHandlerFunctions {
|
|
4
|
-
showBabylonInspector: (show: boolean) => void;
|
|
5
|
-
setIsAuthoring: (isAuthoring: boolean) => void;
|
|
6
|
-
disposeApp: () => void;
|
|
7
|
-
stopApp: () => void;
|
|
8
|
-
startApp: (container: HTMLElement) => void;
|
|
9
|
-
setState: (finalState: string, duration?: number) => void;
|
|
10
|
-
setDevicePreview: (x: number, y: number) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function makeAppHandler(functions: AppHandlerFunctions): Handler;
|