@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.16.8 → 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,401 +1,411 @@
|
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
__classPrivateFieldSet(this,
|
|
102
|
-
__classPrivateFieldSet(this,
|
|
103
|
-
__classPrivateFieldSet(this,
|
|
104
|
-
__classPrivateFieldSet(this,
|
|
105
|
-
__classPrivateFieldSet(this,
|
|
106
|
-
__classPrivateFieldSet(this,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
__classPrivateFieldGet(this,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
object.localToWorld(
|
|
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
|
-
return this.constructRestrictionResult(
|
|
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
|
-
distanceCA.distanceSquared
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
__classPrivateFieldGet(this,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
line.
|
|
321
|
-
line.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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 _GeometryRestriction_eventEngine, _GeometryRestriction_rayCasterParams, _GeometryRestriction_raycaster, _GeometryRestriction_viewport, _GeometryRestriction_geometryMathManager, _GeometryRestriction_lineIntersectionPercentage, _GeometryRestriction_nodes, _GeometryRestriction_pointIntersectionPercentage, _GeometryRestriction_radius, _GeometryRestriction_sceneBoundingSphereRadius, _GeometryRestriction_settings, _GeometryRestriction_snapRestrictions, _GeometryRestriction_snapToEdges, _GeometryRestriction_snapToEdgesRadius, _GeometryRestriction_snapToFaces, _GeometryRestriction_snapToVertices, _GeometryRestriction_snapToVerticesRadius, _GeometryRestriction_visualizationObject, _GeometryRestriction_wireframe, _GeometryRestriction_wireframeColor, _GeometryRestriction_wireframeDepthTest, _GeometryRestriction_wireframePointSize;
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.GeometryRestriction = void 0;
|
|
49
|
+
const viewer_1 = require("@shapediver/viewer");
|
|
50
|
+
const viewer_shared_math_1 = require("@shapediver/viewer.shared.math");
|
|
51
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
52
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
53
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
54
|
+
const THREE = __importStar(require("three"));
|
|
55
|
+
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
56
|
+
let pointTexture = viewer_1.MaterialEngine.instance
|
|
57
|
+
.loadMap("https://viewer.shapediver.com/v3/graphics/point_soft.png")
|
|
58
|
+
.then((mapData) => {
|
|
59
|
+
pointTexture = new THREE.Texture(mapData.image);
|
|
60
|
+
pointTexture.needsUpdate = true;
|
|
61
|
+
return pointTexture;
|
|
62
|
+
});
|
|
63
|
+
// #endregion Type aliases (1)
|
|
64
|
+
// #region Classes (1)
|
|
65
|
+
class GeometryRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
66
|
+
// #endregion Properties (17)
|
|
67
|
+
// #region Constructors (1)
|
|
68
|
+
constructor(viewport, geometryMathManager, parentNode, id, settings, properties) {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
|
+
super(viewport, parentNode, id, properties);
|
|
71
|
+
// #region Properties (17)
|
|
72
|
+
_GeometryRestriction_eventEngine.set(this, viewer_shared_services_1.EventEngine.instance);
|
|
73
|
+
_GeometryRestriction_rayCasterParams.set(this, {
|
|
74
|
+
Line: { threshold: 1 },
|
|
75
|
+
Line2: { threshold: 1 },
|
|
76
|
+
Points: { threshold: 1 },
|
|
77
|
+
Mesh: {},
|
|
78
|
+
LOD: {},
|
|
79
|
+
Sprite: {},
|
|
80
|
+
});
|
|
81
|
+
_GeometryRestriction_raycaster.set(this, new THREE.Raycaster());
|
|
82
|
+
_GeometryRestriction_viewport.set(this, void 0);
|
|
83
|
+
_GeometryRestriction_geometryMathManager.set(this, void 0);
|
|
84
|
+
_GeometryRestriction_lineIntersectionPercentage.set(this, 0.025);
|
|
85
|
+
_GeometryRestriction_nodes.set(this, []);
|
|
86
|
+
_GeometryRestriction_pointIntersectionPercentage.set(this, 0.025);
|
|
87
|
+
_GeometryRestriction_radius.set(this, void 0);
|
|
88
|
+
_GeometryRestriction_sceneBoundingSphereRadius.set(this, 0);
|
|
89
|
+
_GeometryRestriction_settings.set(this, void 0);
|
|
90
|
+
_GeometryRestriction_snapRestrictions.set(this, {});
|
|
91
|
+
_GeometryRestriction_snapToEdges.set(this, true);
|
|
92
|
+
_GeometryRestriction_snapToEdgesRadius.set(this, void 0);
|
|
93
|
+
_GeometryRestriction_snapToFaces.set(this, true);
|
|
94
|
+
_GeometryRestriction_snapToVertices.set(this, true);
|
|
95
|
+
_GeometryRestriction_snapToVerticesRadius.set(this, void 0);
|
|
96
|
+
_GeometryRestriction_visualizationObject.set(this, new THREE.Object3D());
|
|
97
|
+
_GeometryRestriction_wireframe.set(this, void 0);
|
|
98
|
+
_GeometryRestriction_wireframeColor.set(this, void 0);
|
|
99
|
+
_GeometryRestriction_wireframeDepthTest.set(this, void 0);
|
|
100
|
+
_GeometryRestriction_wireframePointSize.set(this, void 0);
|
|
101
|
+
__classPrivateFieldSet(this, _GeometryRestriction_viewport, viewport, "f");
|
|
102
|
+
__classPrivateFieldSet(this, _GeometryRestriction_settings, settings, "f");
|
|
103
|
+
__classPrivateFieldSet(this, _GeometryRestriction_geometryMathManager, geometryMathManager, "f");
|
|
104
|
+
__classPrivateFieldSet(this, _GeometryRestriction_wireframe, (_b = (_a = properties.wireframe) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _GeometryRestriction_settings, "f").wireframe) !== null && _b !== void 0 ? _b : true, "f");
|
|
105
|
+
__classPrivateFieldSet(this, _GeometryRestriction_wireframeColor, (_d = (_c = properties.wireframeColor) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _GeometryRestriction_settings, "f").wireframeColor) !== null && _d !== void 0 ? _d : __classPrivateFieldGet(this, _GeometryRestriction_settings, "f").points.color_1, "f");
|
|
106
|
+
__classPrivateFieldSet(this, _GeometryRestriction_wireframePointSize, properties.wireframePointSize
|
|
107
|
+
? properties.wireframePointSize * __classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").pointSize
|
|
108
|
+
: 10 * __classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").pointSize, "f");
|
|
109
|
+
__classPrivateFieldSet(this, _GeometryRestriction_wireframeDepthTest, (_e = properties.wireframeDepthTest) !== null && _e !== void 0 ? _e : true, "f");
|
|
110
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToVertices, (_f = properties.snapToVertices) !== null && _f !== void 0 ? _f : true, "f");
|
|
111
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToEdges, (_g = properties.snapToEdges) !== null && _g !== void 0 ? _g : true, "f");
|
|
112
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToFaces, (_h = properties.snapToFaces) !== null && _h !== void 0 ? _h : true, "f");
|
|
113
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToVerticesRadius, properties.snapToVerticesRadius, "f");
|
|
114
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToEdgesRadius, properties.snapToEdgesRadius, "f");
|
|
115
|
+
__classPrivateFieldSet(this, _GeometryRestriction_radius, properties.radius, "f");
|
|
116
|
+
__classPrivateFieldSet(this, _GeometryRestriction_sceneBoundingSphereRadius, viewer_1.sceneTree.root.boundingBox.boundingSphere.radius, "f");
|
|
117
|
+
this.updateIntersectionThresholds();
|
|
118
|
+
__classPrivateFieldGet(this, _GeometryRestriction_eventEngine, "f").addListener(viewer_shared_services_1.EVENTTYPE.SCENE.SCENE_BOUNDING_BOX_CHANGE, (e) => {
|
|
119
|
+
const event = e;
|
|
120
|
+
if (event.viewportId === __classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").id) {
|
|
121
|
+
const boundingBox = new viewer_shared_math_1.Box(event.boundingBox.min, event.boundingBox.max);
|
|
122
|
+
__classPrivateFieldSet(this, _GeometryRestriction_sceneBoundingSphereRadius, boundingBox.boundingSphere.radius, "f");
|
|
123
|
+
this.updateIntersectionThresholds();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
this.updateNodes(properties.nodes);
|
|
127
|
+
}
|
|
128
|
+
// #endregion Constructors (1)
|
|
129
|
+
// #region Public Getters And Setters (8)
|
|
130
|
+
get nodes() {
|
|
131
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_nodes, "f");
|
|
132
|
+
}
|
|
133
|
+
get snapRestrictions() {
|
|
134
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_snapRestrictions, "f");
|
|
135
|
+
}
|
|
136
|
+
get snapToEdges() {
|
|
137
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_snapToEdges, "f");
|
|
138
|
+
}
|
|
139
|
+
set snapToEdges(value) {
|
|
140
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToEdges, value, "f");
|
|
141
|
+
}
|
|
142
|
+
get snapToFaces() {
|
|
143
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_snapToFaces, "f");
|
|
144
|
+
}
|
|
145
|
+
set snapToFaces(value) {
|
|
146
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToFaces, value, "f");
|
|
147
|
+
}
|
|
148
|
+
get snapToVertices() {
|
|
149
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_snapToVertices, "f");
|
|
150
|
+
}
|
|
151
|
+
set snapToVertices(value) {
|
|
152
|
+
__classPrivateFieldSet(this, _GeometryRestriction_snapToVertices, value, "f");
|
|
153
|
+
}
|
|
154
|
+
// #endregion Public Getters And Setters (8)
|
|
155
|
+
// #region Public Methods (3)
|
|
156
|
+
rayTrace(ray, metaData) {
|
|
157
|
+
var _a, _b, _c, _d, _e, _f;
|
|
158
|
+
if (this.enabled === false)
|
|
159
|
+
return;
|
|
160
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_snapToVertices, "f") === false &&
|
|
161
|
+
__classPrivateFieldGet(this, _GeometryRestriction_snapToEdges, "f") === false &&
|
|
162
|
+
__classPrivateFieldGet(this, _GeometryRestriction_snapToFaces, "f") === false)
|
|
163
|
+
return;
|
|
164
|
+
// assign raycaster parameters
|
|
165
|
+
__classPrivateFieldGet(this, _GeometryRestriction_raycaster, "f").params = __classPrivateFieldGet(this, _GeometryRestriction_rayCasterParams, "f");
|
|
166
|
+
__classPrivateFieldGet(this, _GeometryRestriction_raycaster, "f").ray.direction.set(ray.direction[0], ray.direction[1], ray.direction[2]);
|
|
167
|
+
__classPrivateFieldGet(this, _GeometryRestriction_raycaster, "f").ray.origin.set(ray.origin[0], ray.origin[1], ray.origin[2]);
|
|
168
|
+
// intersect all nodes
|
|
169
|
+
let intersections = [];
|
|
170
|
+
__classPrivateFieldGet(this, _GeometryRestriction_nodes, "f").forEach((node) => {
|
|
171
|
+
const threeJsObject = node.convertedObject[__classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").id];
|
|
172
|
+
if (threeJsObject) {
|
|
173
|
+
const currentIntersections = __classPrivateFieldGet(this, _GeometryRestriction_raycaster, "f").intersectObject(threeJsObject);
|
|
174
|
+
intersections = intersections.concat(currentIntersections);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
// sort
|
|
178
|
+
intersections.sort((a, b) => a.distance - b.distance);
|
|
179
|
+
// return first intersection
|
|
180
|
+
if (intersections.length > 0) {
|
|
181
|
+
const object = intersections[0].object;
|
|
182
|
+
let geometryRestrictionIntersectionData;
|
|
183
|
+
// search the three.js object hierarchy for the converted object
|
|
184
|
+
let tempObject = object;
|
|
185
|
+
while (tempObject.parent) {
|
|
186
|
+
const intersectedNode = __classPrivateFieldGet(this, _GeometryRestriction_nodes, "f").find((node) => node.id === tempObject.SDid &&
|
|
187
|
+
node.version === tempObject.SDversion);
|
|
188
|
+
if (intersectedNode) {
|
|
189
|
+
// from this node, we can get the geometry data
|
|
190
|
+
intersectedNode.traverseData((d) => {
|
|
191
|
+
if (d instanceof viewer_shared_node_tree_1.GeometryData &&
|
|
192
|
+
d.id === object.parent.SDid &&
|
|
193
|
+
d.version === object.parent.SDversion) {
|
|
194
|
+
geometryRestrictionIntersectionData = {
|
|
195
|
+
node: intersectedNode,
|
|
196
|
+
geometryData: d,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
tempObject = tempObject.parent;
|
|
203
|
+
}
|
|
204
|
+
const geometry = object.geometry;
|
|
205
|
+
const positionAttribute = geometry.getAttribute("position");
|
|
206
|
+
if (object instanceof THREE.Points &&
|
|
207
|
+
intersections[0].index !== undefined) {
|
|
208
|
+
if (!__classPrivateFieldGet(this, _GeometryRestriction_snapToVertices, "f"))
|
|
209
|
+
return;
|
|
210
|
+
const vertex = new THREE.Vector3();
|
|
211
|
+
vertex.fromBufferAttribute(positionAttribute, intersections[0].index);
|
|
212
|
+
object.localToWorld(vertex);
|
|
213
|
+
return this.constructRestrictionResult(gl_matrix_1.vec3.fromValues(vertex.x, vertex.y, vertex.z), intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
214
|
+
}
|
|
215
|
+
const intersectionPoint = intersections[0].point;
|
|
216
|
+
const intersectionPointVec3 = gl_matrix_1.vec3.fromValues(intersectionPoint.x, intersectionPoint.y, intersectionPoint.z);
|
|
217
|
+
if (!intersections[0].face)
|
|
218
|
+
return this.constructRestrictionResult(intersectionPointVec3, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
219
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_snapToVertices, "f") === true || __classPrivateFieldGet(this, _GeometryRestriction_snapToEdges, "f") === true) {
|
|
220
|
+
const vertexA = new THREE.Vector3();
|
|
221
|
+
vertexA.fromBufferAttribute(positionAttribute, intersections[0].face.a);
|
|
222
|
+
object.localToWorld(vertexA);
|
|
223
|
+
const vertexAVec3 = gl_matrix_1.vec3.fromValues(vertexA.x, vertexA.y, vertexA.z);
|
|
224
|
+
const vertexB = new THREE.Vector3();
|
|
225
|
+
vertexB.fromBufferAttribute(positionAttribute, intersections[0].face.b);
|
|
226
|
+
object.localToWorld(vertexB);
|
|
227
|
+
const vertexBVec3 = gl_matrix_1.vec3.fromValues(vertexB.x, vertexB.y, vertexB.z);
|
|
228
|
+
const vertexC = new THREE.Vector3();
|
|
229
|
+
vertexC.fromBufferAttribute(positionAttribute, intersections[0].face.c);
|
|
230
|
+
object.localToWorld(vertexC);
|
|
231
|
+
const vertexCVec3 = gl_matrix_1.vec3.fromValues(vertexC.x, vertexC.y, vertexC.z);
|
|
232
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_snapToVertices, "f") === true) {
|
|
233
|
+
const distanceA = this.checkDistance(intersectionPointVec3, vertexAVec3, (_a = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _GeometryRestriction_snapToVerticesRadius, "f"));
|
|
234
|
+
const distanceB = this.checkDistance(intersectionPointVec3, vertexBVec3, (_b = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _GeometryRestriction_snapToVerticesRadius, "f"));
|
|
235
|
+
const distanceC = this.checkDistance(intersectionPointVec3, vertexCVec3, (_c = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _GeometryRestriction_snapToVerticesRadius, "f"));
|
|
236
|
+
// part 1 - check if the intersection point is close to a vertex
|
|
237
|
+
if (distanceA.check &&
|
|
238
|
+
distanceA.distanceSquared < distanceB.distanceSquared &&
|
|
239
|
+
distanceA.distanceSquared < distanceC.distanceSquared) {
|
|
240
|
+
return this.constructRestrictionResult(vertexAVec3, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
241
|
+
}
|
|
242
|
+
else if (distanceB.check &&
|
|
243
|
+
distanceB.distanceSquared < distanceA.distanceSquared &&
|
|
244
|
+
distanceB.distanceSquared < distanceC.distanceSquared) {
|
|
245
|
+
return this.constructRestrictionResult(vertexBVec3, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
246
|
+
}
|
|
247
|
+
else if (distanceC.check &&
|
|
248
|
+
distanceC.distanceSquared < distanceA.distanceSquared &&
|
|
249
|
+
distanceC.distanceSquared < distanceB.distanceSquared) {
|
|
250
|
+
return this.constructRestrictionResult(vertexCVec3, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_snapToEdges, "f") === true) {
|
|
254
|
+
// part 2 - check if the intersection point is close to an edge
|
|
255
|
+
// create the closest points on the edges
|
|
256
|
+
const closestPointOnEdgeAB = __classPrivateFieldGet(this, _GeometryRestriction_geometryMathManager, "f").closestPointOnLine(vertexAVec3, vertexBVec3, intersectionPointVec3);
|
|
257
|
+
const closestPointOnEdgeBC = __classPrivateFieldGet(this, _GeometryRestriction_geometryMathManager, "f").closestPointOnLine(vertexBVec3, vertexCVec3, intersectionPointVec3);
|
|
258
|
+
const closestPointOnEdgeCA = __classPrivateFieldGet(this, _GeometryRestriction_geometryMathManager, "f").closestPointOnLine(vertexCVec3, vertexAVec3, intersectionPointVec3);
|
|
259
|
+
// create the distances
|
|
260
|
+
const distanceAB = this.checkDistance(intersectionPointVec3, closestPointOnEdgeAB, (_d = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _d !== void 0 ? _d : __classPrivateFieldGet(this, _GeometryRestriction_snapToEdgesRadius, "f"));
|
|
261
|
+
const distanceBC = this.checkDistance(intersectionPointVec3, closestPointOnEdgeBC, (_e = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _e !== void 0 ? _e : __classPrivateFieldGet(this, _GeometryRestriction_snapToEdgesRadius, "f"));
|
|
262
|
+
const distanceCA = this.checkDistance(intersectionPointVec3, closestPointOnEdgeCA, (_f = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _f !== void 0 ? _f : __classPrivateFieldGet(this, _GeometryRestriction_snapToEdgesRadius, "f"));
|
|
263
|
+
// check if the intersection point is close to an edge
|
|
264
|
+
if (distanceAB.check &&
|
|
265
|
+
distanceAB.distanceSquared <
|
|
266
|
+
distanceBC.distanceSquared &&
|
|
267
|
+
distanceAB.distanceSquared < distanceCA.distanceSquared) {
|
|
268
|
+
return this.constructRestrictionResult(closestPointOnEdgeAB, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
269
|
+
}
|
|
270
|
+
else if (distanceBC.check &&
|
|
271
|
+
distanceBC.distanceSquared <
|
|
272
|
+
distanceAB.distanceSquared &&
|
|
273
|
+
distanceBC.distanceSquared < distanceCA.distanceSquared) {
|
|
274
|
+
return this.constructRestrictionResult(closestPointOnEdgeBC, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
275
|
+
}
|
|
276
|
+
else if (distanceCA.check &&
|
|
277
|
+
distanceCA.distanceSquared <
|
|
278
|
+
distanceAB.distanceSquared &&
|
|
279
|
+
distanceCA.distanceSquared < distanceBC.distanceSquared) {
|
|
280
|
+
return this.constructRestrictionResult(closestPointOnEdgeCA, intersections[0].distance, intersections[0].pointOnLine, geometryRestrictionIntersectionData);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_snapToFaces, "f") === true) {
|
|
285
|
+
// part 3 - face intersection
|
|
286
|
+
return this.constructRestrictionResult(gl_matrix_1.vec3.fromValues(intersectionPoint.x, intersectionPoint.y, intersectionPoint.z), intersections[0].distance, undefined, geometryRestrictionIntersectionData);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
updateNodes(nodes) {
|
|
292
|
+
__classPrivateFieldSet(this, _GeometryRestriction_nodes, nodes, "f");
|
|
293
|
+
if (__classPrivateFieldGet(this, _GeometryRestriction_wireframe, "f")) {
|
|
294
|
+
__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f").traverse((object) => {
|
|
295
|
+
if (object instanceof THREE.LineSegments) {
|
|
296
|
+
object.geometry.dispose();
|
|
297
|
+
object.material.dispose();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
this._object3D.remove(__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f"));
|
|
301
|
+
__classPrivateFieldSet(this, _GeometryRestriction_visualizationObject, new THREE.Object3D(), "f");
|
|
302
|
+
__classPrivateFieldGet(this, _GeometryRestriction_nodes, "f").forEach((node) => {
|
|
303
|
+
const threeJsObject = node.convertedObject[__classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").id];
|
|
304
|
+
if (threeJsObject) {
|
|
305
|
+
let parent = threeJsObject.parent;
|
|
306
|
+
while (parent) {
|
|
307
|
+
parent.updateMatrixWorld(true);
|
|
308
|
+
parent = parent.parent;
|
|
309
|
+
}
|
|
310
|
+
threeJsObject.updateMatrixWorld(true);
|
|
311
|
+
threeJsObject.traverse((object) => {
|
|
312
|
+
if (object instanceof THREE.Mesh) {
|
|
313
|
+
const wireframe = new THREE.WireframeGeometry(object.geometry);
|
|
314
|
+
const line = new THREE.LineSegments(wireframe, new THREE.LineBasicMaterial({
|
|
315
|
+
color: new THREE.Color(__classPrivateFieldGet(this, _GeometryRestriction_wireframeColor, "f")),
|
|
316
|
+
depthTest: __classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"),
|
|
317
|
+
depthWrite: !__classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"),
|
|
318
|
+
}));
|
|
319
|
+
line.matrix.copy(object.matrixWorld);
|
|
320
|
+
line.renderOrder = 100;
|
|
321
|
+
line.matrixAutoUpdate = false;
|
|
322
|
+
__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f").add(line);
|
|
323
|
+
}
|
|
324
|
+
else if (object instanceof THREE.Line) {
|
|
325
|
+
const line = new THREE.Line(object.geometry, new THREE.LineBasicMaterial({
|
|
326
|
+
color: new THREE.Color(__classPrivateFieldGet(this, _GeometryRestriction_wireframeColor, "f")),
|
|
327
|
+
depthTest: __classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"),
|
|
328
|
+
depthWrite: !__classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"),
|
|
329
|
+
}));
|
|
330
|
+
line.matrix.copy(object.matrixWorld);
|
|
331
|
+
line.renderOrder = 100;
|
|
332
|
+
line.matrixAutoUpdate = false;
|
|
333
|
+
__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f").add(line);
|
|
334
|
+
}
|
|
335
|
+
else if (object instanceof THREE.Points) {
|
|
336
|
+
const height = __classPrivateFieldGet(this, _GeometryRestriction_viewport, "f").canvas.height;
|
|
337
|
+
const pointSize = __classPrivateFieldGet(this, _GeometryRestriction_wireframePointSize, "f") * (height / 1080);
|
|
338
|
+
const points = new THREE.Points(object.geometry, new THREE.PointsMaterial(Object.assign({ color: new THREE.Color(__classPrivateFieldGet(this, _GeometryRestriction_wireframeColor, "f")), size: pointSize, sizeAttenuation: false, depthTest: __classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"), depthWrite: !__classPrivateFieldGet(this, _GeometryRestriction_wireframeDepthTest, "f"), transparent: true }, (pointTexture instanceof THREE.Texture
|
|
339
|
+
? { map: pointTexture }
|
|
340
|
+
: {}))));
|
|
341
|
+
points.matrix.copy(object.matrixWorld);
|
|
342
|
+
points.renderOrder = 100;
|
|
343
|
+
points.matrixAutoUpdate = false;
|
|
344
|
+
__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f").add(points);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
this._object3D.add(__classPrivateFieldGet(this, _GeometryRestriction_visualizationObject, "f"));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// #endregion Public Methods (3)
|
|
353
|
+
// #region Protected Methods (1)
|
|
354
|
+
visibilityChanged() { }
|
|
355
|
+
// #endregion Protected Methods (1)
|
|
356
|
+
// #region Private Methods (1)
|
|
357
|
+
updateIntersectionThresholds() {
|
|
358
|
+
var _a, _b, _c;
|
|
359
|
+
__classPrivateFieldGet(this, _GeometryRestriction_rayCasterParams, "f").Points.threshold =
|
|
360
|
+
(_a = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _GeometryRestriction_sceneBoundingSphereRadius, "f") * __classPrivateFieldGet(this, _GeometryRestriction_pointIntersectionPercentage, "f");
|
|
361
|
+
__classPrivateFieldGet(this, _GeometryRestriction_rayCasterParams, "f").Line.threshold =
|
|
362
|
+
(_b = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _GeometryRestriction_sceneBoundingSphereRadius, "f") * __classPrivateFieldGet(this, _GeometryRestriction_lineIntersectionPercentage, "f");
|
|
363
|
+
__classPrivateFieldGet(this, _GeometryRestriction_rayCasterParams, "f").Line2.threshold =
|
|
364
|
+
(_c = __classPrivateFieldGet(this, _GeometryRestriction_radius, "f")) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _GeometryRestriction_sceneBoundingSphereRadius, "f") * __classPrivateFieldGet(this, _GeometryRestriction_lineIntersectionPercentage, "f");
|
|
365
|
+
}
|
|
366
|
+
constructRestrictionResult(targetPoint, distanceOriginToClosestIntersectionPoint, closestPointOnRay, geometryRestrictionIntersectionData) {
|
|
367
|
+
const closestPointOnRayVec3 = closestPointOnRay
|
|
368
|
+
? gl_matrix_1.vec3.fromValues(closestPointOnRay.x, closestPointOnRay.y, closestPointOnRay.z)
|
|
369
|
+
: targetPoint;
|
|
370
|
+
return {
|
|
371
|
+
closestIntersectionPoint: closestPointOnRay
|
|
372
|
+
? gl_matrix_1.vec3.fromValues(closestPointOnRay.x, closestPointOnRay.y, closestPointOnRay.z)
|
|
373
|
+
: targetPoint,
|
|
374
|
+
distanceOriginToClosestIntersectionPointSquared: distanceOriginToClosestIntersectionPoint *
|
|
375
|
+
distanceOriginToClosestIntersectionPoint,
|
|
376
|
+
targetPoint,
|
|
377
|
+
distanceClosestPointToTargetPointSquared: closestPointOnRayVec3 !== targetPoint
|
|
378
|
+
? gl_matrix_1.vec3.sqrDist(closestPointOnRayVec3, targetPoint)
|
|
379
|
+
: 0,
|
|
380
|
+
restriction: this,
|
|
381
|
+
restrictionIntersectionData: geometryRestrictionIntersectionData,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* We check the distance between two points.
|
|
386
|
+
* If a radius is given, we check if the distance is smaller than the radius.
|
|
387
|
+
* If no radius is given, we move to the screen space distance check.
|
|
388
|
+
*
|
|
389
|
+
* @param point1
|
|
390
|
+
* @param point2
|
|
391
|
+
* @param radius
|
|
392
|
+
* @returns
|
|
393
|
+
*/
|
|
394
|
+
checkDistance(point1, point2, radius) {
|
|
395
|
+
if (radius !== undefined) {
|
|
396
|
+
const distance = gl_matrix_1.vec3.sqrDist(point1, point2);
|
|
397
|
+
return {
|
|
398
|
+
distanceSquared: distance * distance,
|
|
399
|
+
check: distance < radius,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
return __classPrivateFieldGet(this, _GeometryRestriction_geometryMathManager, "f").screenSpaceDistanceCheck(point1, point2, __classPrivateFieldGet(this, _GeometryRestriction_settings, "f").points.size_0 *
|
|
404
|
+
__classPrivateFieldGet(this, _GeometryRestriction_settings, "f").distanceMultiplicationFactor);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
exports.GeometryRestriction = GeometryRestriction;
|
|
409
|
+
_GeometryRestriction_eventEngine = new WeakMap(), _GeometryRestriction_rayCasterParams = new WeakMap(), _GeometryRestriction_raycaster = new WeakMap(), _GeometryRestriction_viewport = new WeakMap(), _GeometryRestriction_geometryMathManager = new WeakMap(), _GeometryRestriction_lineIntersectionPercentage = new WeakMap(), _GeometryRestriction_nodes = new WeakMap(), _GeometryRestriction_pointIntersectionPercentage = new WeakMap(), _GeometryRestriction_radius = new WeakMap(), _GeometryRestriction_sceneBoundingSphereRadius = new WeakMap(), _GeometryRestriction_settings = new WeakMap(), _GeometryRestriction_snapRestrictions = new WeakMap(), _GeometryRestriction_snapToEdges = new WeakMap(), _GeometryRestriction_snapToEdgesRadius = new WeakMap(), _GeometryRestriction_snapToFaces = new WeakMap(), _GeometryRestriction_snapToVertices = new WeakMap(), _GeometryRestriction_snapToVerticesRadius = new WeakMap(), _GeometryRestriction_visualizationObject = new WeakMap(), _GeometryRestriction_wireframe = new WeakMap(), _GeometryRestriction_wireframeColor = new WeakMap(), _GeometryRestriction_wireframeDepthTest = new WeakMap(), _GeometryRestriction_wireframePointSize = new WeakMap();
|
|
410
|
+
// #endregion Classes (1)
|
|
401
411
|
//# sourceMappingURL=GeometryRestriction.js.map
|