@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.16.7 → 3.16.9
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/dist/api/implementation/AbstractRestrictionApi.d.ts +12 -12
- package/dist/api/implementation/AbstractRestrictionApi.js +46 -46
- package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -1
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +12 -12
- package/dist/api/implementation/AbstractSnapRestrictionApi.js +46 -46
- package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -1
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +6 -6
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +23 -23
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +14 -14
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js +53 -53
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -1
- package/dist/api/implementation/line/LineRestrictionApi.d.ts +10 -10
- package/dist/api/implementation/line/LineRestrictionApi.js +39 -39
- package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +19 -19
- package/dist/api/implementation/plane/PlaneRestrictionApi.js +66 -66
- package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +39 -39
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +6 -6
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +23 -23
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js +39 -39
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -1
- package/dist/api/implementation/point/PointRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/point/PointRestrictionApi.js +36 -36
- package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -1
- package/dist/api/interfaces/IRestrictionApi.d.ts +10 -10
- package/dist/api/interfaces/IRestrictionApi.js +2 -2
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts +12 -12
- package/dist/api/interfaces/ISnapRestrictionApi.js +2 -2
- package/dist/implementation/EventManager.d.ts +25 -25
- package/dist/implementation/EventManager.d.ts.map +1 -1
- package/dist/implementation/EventManager.js +62 -62
- package/dist/implementation/EventManager.js.map +1 -1
- package/dist/implementation/GeometryMathManager.d.ts +87 -87
- package/dist/implementation/GeometryMathManager.js +260 -260
- package/dist/implementation/GeometryMathManager.js.map +1 -1
- package/dist/implementation/RestrictionManager.d.ts +28 -28
- package/dist/implementation/RestrictionManager.js +323 -323
- package/dist/implementation/RestrictionManager.js.map +1 -1
- package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -42
- package/dist/implementation/restrictions/AbstractRestriction.js +164 -154
- package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -1
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +35 -35
- package/dist/implementation/restrictions/AbstractSnapRestriction.js +150 -140
- package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts +10 -10
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.js +50 -50
- package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -1
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +17 -17
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +62 -62
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +92 -92
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js +410 -400
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -1
- package/dist/implementation/restrictions/line/LineRestriction.d.ts +58 -58
- package/dist/implementation/restrictions/line/LineRestriction.js +291 -281
- package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +65 -65
- package/dist/implementation/restrictions/plane/PlaneRestriction.js +306 -306
- package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +39 -39
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +346 -346
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +27 -27
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +239 -229
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +39 -39
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js +318 -308
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -1
- package/dist/implementation/restrictions/point/PointRestriction.d.ts +45 -45
- package/dist/implementation/restrictions/point/PointRestriction.js +166 -156
- package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.js +37 -37
- package/dist/interfaces/IDragAnchor.d.ts +8 -8
- package/dist/interfaces/IDragAnchor.js +2 -2
- package/dist/interfaces/IRestriction.d.ts +117 -117
- package/dist/interfaces/IRestriction.d.ts.map +1 -1
- package/dist/interfaces/IRestriction.js +23 -23
- package/dist/interfaces/IRestriction.js.map +1 -1
- package/dist/interfaces/IRestrictionManager.d.ts +13 -13
- package/dist/interfaces/IRestrictionManager.js +2 -2
- package/dist/interfaces/ISnapRestriction.d.ts +81 -81
- package/dist/interfaces/ISnapRestriction.d.ts.map +1 -1
- package/dist/interfaces/ISnapRestriction.js +3 -3
- package/package.json +10 -10
|
@@ -1,282 +1,292 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (properties.
|
|
86
|
-
__classPrivateFieldSet(this,
|
|
87
|
-
type: IRestriction_1.RESTRICTION_TYPE.POINT,
|
|
88
|
-
point: properties.
|
|
89
|
-
radius: properties.
|
|
90
|
-
wireframe: properties.wireframe,
|
|
91
|
-
wireframeColor: properties.wireframeColor,
|
|
92
|
-
wireframeDepthTest: properties.wireframeDepthTest,
|
|
93
|
-
}), "f");
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
//
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
gl_matrix_1.vec3.
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
36
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
37
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
38
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
39
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
40
|
+
};
|
|
41
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
42
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
43
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
44
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
45
|
+
};
|
|
46
|
+
var _LineRestriction_viewport, _LineRestriction_dragLineLength, _LineRestriction_dragRay, _LineRestriction_point1, _LineRestriction_point1Restriction, _LineRestriction_point2, _LineRestriction_point2Restriction, _LineRestriction_radius, _LineRestriction_settings, _LineRestriction_snapRestrictions, _LineRestriction_visualizationObject, _LineRestriction_wireframe, _LineRestriction_wireframeColor, _LineRestriction_wireframeDepthTest;
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.LineRestriction = void 0;
|
|
49
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
50
|
+
const THREE = __importStar(require("three"));
|
|
51
|
+
const IRestriction_1 = require("../../../interfaces/IRestriction");
|
|
52
|
+
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
53
|
+
const PointRestriction_1 = require("../point/PointRestriction");
|
|
54
|
+
// #endregion Type aliases (1)
|
|
55
|
+
// #region Classes (1)
|
|
56
|
+
class LineRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
57
|
+
// #endregion Properties (11)
|
|
58
|
+
// #region Constructors (1)
|
|
59
|
+
constructor(viewport, geometryMathManager, parentNode, id, settings, properties) {
|
|
60
|
+
var _a, _b, _c, _d, _e;
|
|
61
|
+
super(viewport, parentNode, id, properties);
|
|
62
|
+
// #region Properties (11)
|
|
63
|
+
_LineRestriction_viewport.set(this, void 0);
|
|
64
|
+
_LineRestriction_dragLineLength.set(this, void 0);
|
|
65
|
+
_LineRestriction_dragRay.set(this, void 0);
|
|
66
|
+
_LineRestriction_point1.set(this, void 0);
|
|
67
|
+
_LineRestriction_point1Restriction.set(this, void 0);
|
|
68
|
+
_LineRestriction_point2.set(this, void 0);
|
|
69
|
+
_LineRestriction_point2Restriction.set(this, void 0);
|
|
70
|
+
_LineRestriction_radius.set(this, void 0);
|
|
71
|
+
_LineRestriction_settings.set(this, void 0);
|
|
72
|
+
_LineRestriction_snapRestrictions.set(this, {});
|
|
73
|
+
_LineRestriction_visualizationObject.set(this, new THREE.Object3D());
|
|
74
|
+
_LineRestriction_wireframe.set(this, void 0);
|
|
75
|
+
_LineRestriction_wireframeColor.set(this, void 0);
|
|
76
|
+
_LineRestriction_wireframeDepthTest.set(this, void 0);
|
|
77
|
+
__classPrivateFieldSet(this, _LineRestriction_viewport, viewport, "f");
|
|
78
|
+
__classPrivateFieldSet(this, _LineRestriction_point1, properties.point1, "f");
|
|
79
|
+
__classPrivateFieldSet(this, _LineRestriction_point2, properties.point2, "f");
|
|
80
|
+
__classPrivateFieldSet(this, _LineRestriction_radius, properties.radius || 0, "f");
|
|
81
|
+
__classPrivateFieldSet(this, _LineRestriction_settings, settings, "f");
|
|
82
|
+
__classPrivateFieldSet(this, _LineRestriction_wireframe, (_b = (_a = properties.wireframe) !== null && _a !== void 0 ? _a : settings.wireframe) !== null && _b !== void 0 ? _b : true, "f");
|
|
83
|
+
__classPrivateFieldSet(this, _LineRestriction_wireframeColor, (_d = (_c = properties.wireframeColor) !== null && _c !== void 0 ? _c : settings.wireframeColor) !== null && _d !== void 0 ? _d : settings.points.color_1, "f");
|
|
84
|
+
__classPrivateFieldSet(this, _LineRestriction_wireframeDepthTest, (_e = properties.wireframeDepthTest) !== null && _e !== void 0 ? _e : false, "f");
|
|
85
|
+
if (properties.point1Radius !== undefined) {
|
|
86
|
+
__classPrivateFieldSet(this, _LineRestriction_point1Restriction, new PointRestriction_1.PointRestriction(viewport, geometryMathManager, parentNode, id, settings, {
|
|
87
|
+
type: IRestriction_1.RESTRICTION_TYPE.POINT,
|
|
88
|
+
point: properties.point1,
|
|
89
|
+
radius: properties.point1Radius,
|
|
90
|
+
wireframe: properties.wireframe,
|
|
91
|
+
wireframeColor: properties.wireframeColor,
|
|
92
|
+
wireframeDepthTest: properties.wireframeDepthTest,
|
|
93
|
+
}), "f");
|
|
94
|
+
}
|
|
95
|
+
if (properties.point2Radius !== undefined) {
|
|
96
|
+
__classPrivateFieldSet(this, _LineRestriction_point2Restriction, new PointRestriction_1.PointRestriction(viewport, geometryMathManager, parentNode, id, settings, {
|
|
97
|
+
type: IRestriction_1.RESTRICTION_TYPE.POINT,
|
|
98
|
+
point: properties.point2,
|
|
99
|
+
radius: properties.point2Radius,
|
|
100
|
+
wireframe: properties.wireframe,
|
|
101
|
+
wireframeColor: properties.wireframeColor,
|
|
102
|
+
wireframeDepthTest: properties.wireframeDepthTest,
|
|
103
|
+
}), "f");
|
|
104
|
+
}
|
|
105
|
+
const direction = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_point2, "f"), __classPrivateFieldGet(this, _LineRestriction_point1, "f"));
|
|
106
|
+
__classPrivateFieldSet(this, _LineRestriction_dragLineLength, gl_matrix_1.vec3.length(direction), "f");
|
|
107
|
+
__classPrivateFieldSet(this, _LineRestriction_dragRay, {
|
|
108
|
+
origin: __classPrivateFieldGet(this, _LineRestriction_point1, "f"),
|
|
109
|
+
direction: gl_matrix_1.vec3.divide(gl_matrix_1.vec3.create(), direction, gl_matrix_1.vec3.fromValues(__classPrivateFieldGet(this, _LineRestriction_dragLineLength, "f"), __classPrivateFieldGet(this, _LineRestriction_dragLineLength, "f"), __classPrivateFieldGet(this, _LineRestriction_dragLineLength, "f"))),
|
|
110
|
+
}, "f");
|
|
111
|
+
if (__classPrivateFieldGet(this, _LineRestriction_wireframe, "f")) {
|
|
112
|
+
const geometry = new THREE.BufferGeometry();
|
|
113
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute([
|
|
114
|
+
__classPrivateFieldGet(this, _LineRestriction_point1, "f")[0],
|
|
115
|
+
__classPrivateFieldGet(this, _LineRestriction_point1, "f")[1],
|
|
116
|
+
__classPrivateFieldGet(this, _LineRestriction_point1, "f")[2],
|
|
117
|
+
__classPrivateFieldGet(this, _LineRestriction_point2, "f")[0],
|
|
118
|
+
__classPrivateFieldGet(this, _LineRestriction_point2, "f")[1],
|
|
119
|
+
__classPrivateFieldGet(this, _LineRestriction_point2, "f")[2],
|
|
120
|
+
], 3));
|
|
121
|
+
const line = new THREE.Line(geometry, new THREE.LineBasicMaterial({
|
|
122
|
+
color: new THREE.Color(__classPrivateFieldGet(this, _LineRestriction_wireframeColor, "f")),
|
|
123
|
+
depthTest: __classPrivateFieldGet(this, _LineRestriction_wireframeDepthTest, "f"),
|
|
124
|
+
depthWrite: !__classPrivateFieldGet(this, _LineRestriction_wireframeDepthTest, "f"),
|
|
125
|
+
}));
|
|
126
|
+
line.matrixAutoUpdate = false;
|
|
127
|
+
line.renderOrder = 100;
|
|
128
|
+
__classPrivateFieldGet(this, _LineRestriction_visualizationObject, "f").add(line);
|
|
129
|
+
this._object3D.add(__classPrivateFieldGet(this, _LineRestriction_visualizationObject, "f"));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// #endregion Constructors (1)
|
|
133
|
+
// #region Public Getters And Setters (5)
|
|
134
|
+
get point1() {
|
|
135
|
+
return __classPrivateFieldGet(this, _LineRestriction_point1, "f");
|
|
136
|
+
}
|
|
137
|
+
get point1Restriction() {
|
|
138
|
+
return __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f");
|
|
139
|
+
}
|
|
140
|
+
get point2() {
|
|
141
|
+
return __classPrivateFieldGet(this, _LineRestriction_point2, "f");
|
|
142
|
+
}
|
|
143
|
+
get point2Restriction() {
|
|
144
|
+
return __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f");
|
|
145
|
+
}
|
|
146
|
+
get radius() {
|
|
147
|
+
return __classPrivateFieldGet(this, _LineRestriction_radius, "f");
|
|
148
|
+
}
|
|
149
|
+
get snapRestrictions() {
|
|
150
|
+
return __classPrivateFieldGet(this, _LineRestriction_snapRestrictions, "f");
|
|
151
|
+
}
|
|
152
|
+
// #endregion Public Getters And Setters (5)
|
|
153
|
+
// #region Public Methods (1)
|
|
154
|
+
isWithinRadius(point) {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
// Check distance from point to the start of the cylinder
|
|
157
|
+
const distance = gl_matrix_1.vec3.squaredDistance(point, __classPrivateFieldGet(this, _LineRestriction_point1, "f"));
|
|
158
|
+
const squaredRadius1 = ((_a = __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f")) === null || _a === void 0 ? void 0 : _a.radius)
|
|
159
|
+
? __classPrivateFieldGet(this, _LineRestriction_radius, "f") > __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f").radius
|
|
160
|
+
? __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f")
|
|
161
|
+
: __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f").radius *
|
|
162
|
+
__classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f").radius
|
|
163
|
+
: __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f");
|
|
164
|
+
if (distance < squaredRadius1) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
// Check distance from point to the end of the cylinder
|
|
168
|
+
const distance2 = gl_matrix_1.vec3.squaredDistance(point, __classPrivateFieldGet(this, _LineRestriction_point2, "f"));
|
|
169
|
+
const squaredRadius2 = ((_b = __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f")) === null || _b === void 0 ? void 0 : _b.radius)
|
|
170
|
+
? __classPrivateFieldGet(this, _LineRestriction_radius, "f") > __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f").radius
|
|
171
|
+
? __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f")
|
|
172
|
+
: __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f").radius *
|
|
173
|
+
__classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f").radius
|
|
174
|
+
: __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f");
|
|
175
|
+
if (distance2 < squaredRadius2) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
// Calculate the closest point on the line segment (between point1 and point2)
|
|
179
|
+
const lineDir = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_point2, "f"), __classPrivateFieldGet(this, _LineRestriction_point1, "f")); // Direction of the line segment
|
|
180
|
+
const lineLengthSquared = gl_matrix_1.vec3.squaredLength(lineDir);
|
|
181
|
+
// Project the point onto the line (scaled projection)
|
|
182
|
+
const projection = gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), point, __classPrivateFieldGet(this, _LineRestriction_point1, "f")), lineDir) /
|
|
183
|
+
lineLengthSquared;
|
|
184
|
+
// Clamp the projection value to ensure it's within the line segment
|
|
185
|
+
const clampedProjection = Math.max(0, Math.min(1, projection));
|
|
186
|
+
// Calculate the closest point on the segment
|
|
187
|
+
const closestPointOnLine = gl_matrix_1.vec3.scaleAndAdd(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_point1, "f"), lineDir, clampedProjection);
|
|
188
|
+
// Check if the point is within the radius of the line
|
|
189
|
+
const distance3 = gl_matrix_1.vec3.squaredDistance(point, closestPointOnLine);
|
|
190
|
+
if (distance3 < __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f")) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
// If all checks fail, return false
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
rayTrace(ray, metaData) {
|
|
197
|
+
const planeNormal = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), ray.direction, __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").direction);
|
|
198
|
+
const Na = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), ray.direction, planeNormal));
|
|
199
|
+
const Nb = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").direction, planeNormal));
|
|
200
|
+
const da = gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").origin, ray.origin), Nb) / gl_matrix_1.vec3.dot(ray.direction, Nb);
|
|
201
|
+
const db = gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), ray.origin, __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").origin), Na) / gl_matrix_1.vec3.dot(__classPrivateFieldGet(this, _LineRestriction_dragRay, "f").direction, Na);
|
|
202
|
+
let pointA = gl_matrix_1.vec3.create();
|
|
203
|
+
if (da < 0) {
|
|
204
|
+
gl_matrix_1.vec3.copy(pointA, ray.origin);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
pointA = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray.origin, gl_matrix_1.vec3.mul(gl_matrix_1.vec3.create(), ray.direction, gl_matrix_1.vec3.fromValues(da, da, da)));
|
|
208
|
+
}
|
|
209
|
+
let pointB = gl_matrix_1.vec3.create();
|
|
210
|
+
if (db < 0) {
|
|
211
|
+
gl_matrix_1.vec3.copy(pointB, __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").origin);
|
|
212
|
+
}
|
|
213
|
+
else if (db < __classPrivateFieldGet(this, _LineRestriction_dragLineLength, "f")) {
|
|
214
|
+
pointB = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").origin, gl_matrix_1.vec3.mul(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _LineRestriction_dragRay, "f").direction, gl_matrix_1.vec3.fromValues(db, db, db)));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
gl_matrix_1.vec3.copy(pointB, __classPrivateFieldGet(this, _LineRestriction_point2, "f"));
|
|
218
|
+
}
|
|
219
|
+
// first, check the simple cases
|
|
220
|
+
// if there the restrictions for the points are set, we need to check them
|
|
221
|
+
const result1 = __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f")
|
|
222
|
+
? __classPrivateFieldGet(this, _LineRestriction_point1Restriction, "f").rayTrace(ray)
|
|
223
|
+
: undefined;
|
|
224
|
+
const result2 = __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f")
|
|
225
|
+
? __classPrivateFieldGet(this, _LineRestriction_point2Restriction, "f").rayTrace(ray)
|
|
226
|
+
: undefined;
|
|
227
|
+
// return the closest result
|
|
228
|
+
if (result1 || result2) {
|
|
229
|
+
if (result1 && result2) {
|
|
230
|
+
if (result1.distanceOriginToClosestIntersectionPointSquared <
|
|
231
|
+
result2.distanceOriginToClosestIntersectionPointSquared) {
|
|
232
|
+
return {
|
|
233
|
+
closestIntersectionPoint: result1.closestIntersectionPoint,
|
|
234
|
+
distanceOriginToClosestIntersectionPointSquared: result1.distanceOriginToClosestIntersectionPointSquared,
|
|
235
|
+
targetPoint: result1.targetPoint,
|
|
236
|
+
distanceClosestPointToTargetPointSquared: result1.distanceClosestPointToTargetPointSquared,
|
|
237
|
+
restriction: this,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
closestIntersectionPoint: result2.closestIntersectionPoint,
|
|
242
|
+
distanceOriginToClosestIntersectionPointSquared: result2.distanceOriginToClosestIntersectionPointSquared,
|
|
243
|
+
targetPoint: result2.targetPoint,
|
|
244
|
+
distanceClosestPointToTargetPointSquared: result2.distanceClosestPointToTargetPointSquared,
|
|
245
|
+
restriction: this,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
const result = (result1 || result2);
|
|
249
|
+
return {
|
|
250
|
+
closestIntersectionPoint: result.closestIntersectionPoint,
|
|
251
|
+
distanceOriginToClosestIntersectionPointSquared: result.distanceOriginToClosestIntersectionPointSquared,
|
|
252
|
+
targetPoint: result.targetPoint,
|
|
253
|
+
distanceClosestPointToTargetPointSquared: result.distanceClosestPointToTargetPointSquared,
|
|
254
|
+
restriction: this,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const distance = gl_matrix_1.vec3.squaredDistance(pointA, pointB);
|
|
258
|
+
if (distance < __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f")) {
|
|
259
|
+
// check if origin is inside the cylinder
|
|
260
|
+
const distanceOrigin = gl_matrix_1.vec3.squaredDistance(ray.origin, pointB);
|
|
261
|
+
if (distanceOrigin < __classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f")) {
|
|
262
|
+
return {
|
|
263
|
+
closestIntersectionPoint: pointA,
|
|
264
|
+
distanceOriginToClosestIntersectionPointSquared: gl_matrix_1.vec3.sqrDist(ray.origin, pointA),
|
|
265
|
+
targetPoint: pointB,
|
|
266
|
+
distanceClosestPointToTargetPointSquared: distance,
|
|
267
|
+
restriction: this,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
// now we calculate the closest point on the cylinder to the ray
|
|
271
|
+
const offset = Math.sqrt(__classPrivateFieldGet(this, _LineRestriction_radius, "f") * __classPrivateFieldGet(this, _LineRestriction_radius, "f") - distance);
|
|
272
|
+
// Compute the entry distance
|
|
273
|
+
const entry = da - offset;
|
|
274
|
+
const closestIntersectionPoint = gl_matrix_1.vec3.scaleAndAdd(gl_matrix_1.vec3.create(), ray.origin, ray.direction, entry);
|
|
275
|
+
return {
|
|
276
|
+
closestIntersectionPoint,
|
|
277
|
+
distanceOriginToClosestIntersectionPointSquared: entry * entry,
|
|
278
|
+
targetPoint: pointB,
|
|
279
|
+
distanceClosestPointToTargetPointSquared: distance,
|
|
280
|
+
restriction: this,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// #endregion Public Methods (1)
|
|
286
|
+
// #region Protected Methods (1)
|
|
287
|
+
visibilityChanged() { }
|
|
288
|
+
}
|
|
289
|
+
exports.LineRestriction = LineRestriction;
|
|
290
|
+
_LineRestriction_viewport = new WeakMap(), _LineRestriction_dragLineLength = new WeakMap(), _LineRestriction_dragRay = new WeakMap(), _LineRestriction_point1 = new WeakMap(), _LineRestriction_point1Restriction = new WeakMap(), _LineRestriction_point2 = new WeakMap(), _LineRestriction_point2Restriction = new WeakMap(), _LineRestriction_radius = new WeakMap(), _LineRestriction_settings = new WeakMap(), _LineRestriction_snapRestrictions = new WeakMap(), _LineRestriction_visualizationObject = new WeakMap(), _LineRestriction_wireframe = new WeakMap(), _LineRestriction_wireframeColor = new WeakMap(), _LineRestriction_wireframeDepthTest = new WeakMap();
|
|
291
|
+
// #endregion Classes (1)
|
|
282
292
|
//# sourceMappingURL=LineRestriction.js.map
|