@thatopen/components 2.0.25 → 2.1.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/dist/core/Components/index.d.ts +1 -1
- package/dist/fragments/BoundingBoxer/index.d.ts +23 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +838 -810
- package/dist/measurement/MeasurementUtils/index.d.ts +2 -8
- package/dist/namespace.d.ts +1398 -1381
- package/package.json +56 -56
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ var kn = Object.defineProperty;
|
|
|
2
2
|
var Wn = (l, s, t) => s in l ? kn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
|
|
3
3
|
var I = (l, s, t) => (Wn(l, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
4
|
import * as g from "three";
|
|
5
|
-
import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as
|
|
5
|
+
import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as Ot, BackSide as Zn, DoubleSide as Ln, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Pt, Object3D as ri, Euler as qn, MeshBasicMaterial as yn, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } from "three";
|
|
6
6
|
import * as Vt from "@thatopen/fragments";
|
|
7
7
|
import { Serializer as to } from "@thatopen/fragments";
|
|
8
8
|
import * as b from "web-ifc";
|
|
9
|
-
const Mn = 0, eo = 1, so = 2,
|
|
9
|
+
const Mn = 0, eo = 1, so = 2, xi = 2, Ys = 1.25, bi = 1, Cs = 6 * 4 + 4 + 4, Us = 65535, io = Math.pow(2, -24), Vs = Symbol("SKIP_GENERATION");
|
|
10
10
|
function no(l) {
|
|
11
11
|
return l.index ? l.index.count : l.attributes.position.count;
|
|
12
12
|
}
|
|
@@ -63,7 +63,7 @@ function K(l, s, t) {
|
|
|
63
63
|
function co(l) {
|
|
64
64
|
l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function vi(l) {
|
|
67
67
|
let s = -1, t = -1 / 0;
|
|
68
68
|
for (let e = 0; e < 3; e++) {
|
|
69
69
|
const i = l[e + 3] - l[e];
|
|
@@ -71,10 +71,10 @@ function Bi(l) {
|
|
|
71
71
|
}
|
|
72
72
|
return s;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Bi(l, s) {
|
|
75
75
|
s.set(l);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Yi(l, s, t) {
|
|
78
78
|
let e, i;
|
|
79
79
|
for (let o = 0; o < 3; o++) {
|
|
80
80
|
const n = o + 3;
|
|
@@ -149,9 +149,9 @@ const Mt = 32, Eo = (l, s) => l.candidate - s.candidate, Ut = new Array(Mt).fill
|
|
|
149
149
|
function uo(l, s, t, e, i, o) {
|
|
150
150
|
let n = -1, r = 0;
|
|
151
151
|
if (o === Mn)
|
|
152
|
-
n =
|
|
152
|
+
n = vi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
|
|
153
153
|
else if (o === eo)
|
|
154
|
-
n =
|
|
154
|
+
n = vi(l), n !== -1 && (r = Io(t, e, i, n));
|
|
155
155
|
else if (o === so) {
|
|
156
156
|
const a = Re(l);
|
|
157
157
|
let c = Ys * i;
|
|
@@ -194,7 +194,7 @@ function uo(l, s, t, e, i, o) {
|
|
|
194
194
|
O !== 0 && (L = Re(S) / a);
|
|
195
195
|
let w = 0;
|
|
196
196
|
_ !== 0 && (w = Re(N) / a);
|
|
197
|
-
const y =
|
|
197
|
+
const y = bi + Ys * (L * O + w * _);
|
|
198
198
|
y < c && (n = E, c = y, r = T.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
@@ -212,20 +212,20 @@ function uo(l, s, t, e, i, o) {
|
|
|
212
212
|
_.count++, Qe(F, t, _.bounds);
|
|
213
213
|
}
|
|
214
214
|
const C = Ut[Mt - 1];
|
|
215
|
-
|
|
215
|
+
Bi(C.bounds, C.rightCacheBounds);
|
|
216
216
|
for (let F = Mt - 2; F >= 0; F--) {
|
|
217
217
|
const p = Ut[F], T = Ut[F + 1];
|
|
218
|
-
|
|
218
|
+
Yi(p.bounds, T.rightCacheBounds, p.rightCacheBounds);
|
|
219
219
|
}
|
|
220
220
|
let A = 0;
|
|
221
221
|
for (let F = 0; F < Mt - 1; F++) {
|
|
222
222
|
const p = Ut[F], T = p.count, O = p.bounds, S = Ut[F + 1].rightCacheBounds;
|
|
223
|
-
T !== 0 && (A === 0 ?
|
|
223
|
+
T !== 0 && (A === 0 ? Bi(O, je) : Yi(O, je, je)), A += T;
|
|
224
224
|
let N = 0, L = 0;
|
|
225
225
|
A !== 0 && (N = Re(je) / a);
|
|
226
226
|
const w = i - A;
|
|
227
227
|
w !== 0 && (L = Re(S) / a);
|
|
228
|
-
const y =
|
|
228
|
+
const y = bi + Ys * (N * A + L * w);
|
|
229
229
|
y < c && (n = E, c = y, r = p.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
@@ -410,7 +410,7 @@ const Ro = function() {
|
|
|
410
410
|
let C, A;
|
|
411
411
|
m !== 0 ? C = (d * E - f * u) / m : C = 0, A = (d + C * E) / u, n.x = C, n.y = A;
|
|
412
412
|
};
|
|
413
|
-
}(),
|
|
413
|
+
}(), Oi = function() {
|
|
414
414
|
const l = new fe(), s = new M(), t = new M();
|
|
415
415
|
return function(i, o, n, r) {
|
|
416
416
|
Ro(i, o, l);
|
|
@@ -440,7 +440,7 @@ const Ro = function() {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
}(), Ao = function() {
|
|
443
|
-
const l = new M(), s = new M(), t = new
|
|
443
|
+
const l = new M(), s = new M(), t = new Fi(), e = new Lt();
|
|
444
444
|
return function(o, n) {
|
|
445
445
|
const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
|
|
446
446
|
if (e.start = c, e.end = h, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = h, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
|
|
@@ -459,7 +459,7 @@ function zs(l) {
|
|
|
459
459
|
}
|
|
460
460
|
class Ft extends ue {
|
|
461
461
|
constructor(...s) {
|
|
462
|
-
super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Xn(), this.plane = new
|
|
462
|
+
super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Xn(), this.plane = new Fi(), this.needsUpdate = !0;
|
|
463
463
|
}
|
|
464
464
|
intersectsSphere(s) {
|
|
465
465
|
return Ao(s, this);
|
|
@@ -482,7 +482,7 @@ Ft.prototype.closestPointToSegment = function() {
|
|
|
482
482
|
let h, d = 1 / 0;
|
|
483
483
|
for (let E = 0; E < 3; E++) {
|
|
484
484
|
const u = (E + 1) % 3;
|
|
485
|
-
t.start.copy(c[E]), t.end.copy(c[u]),
|
|
485
|
+
t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
|
|
486
486
|
}
|
|
487
487
|
return this.closestPointToPoint(r, l), h = r.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), h = a.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
|
|
488
488
|
};
|
|
@@ -586,7 +586,7 @@ Ft.prototype.distanceToTriangle = function() {
|
|
|
586
586
|
e.set(this[E], this[u]);
|
|
587
587
|
for (let f = 0; f < 3; f++) {
|
|
588
588
|
const R = t[f], m = t[(f + 1) % 3];
|
|
589
|
-
i.set(n[R], n[m]),
|
|
589
|
+
i.set(n[R], n[m]), Oi(e, i, l, s);
|
|
590
590
|
const C = l.distanceToSquared(s);
|
|
591
591
|
C < h && (h = C, r && r.copy(l), a && a.copy(s));
|
|
592
592
|
}
|
|
@@ -712,7 +712,7 @@ at.prototype.distanceToBox = function() {
|
|
|
712
712
|
const C = s[m];
|
|
713
713
|
for (let A = 0; A < 12; A++) {
|
|
714
714
|
const F = t[A];
|
|
715
|
-
|
|
715
|
+
Oi(C, F, e, i);
|
|
716
716
|
const p = e.distanceToSquared(i);
|
|
717
717
|
if (p < f && (f = p, a && a.copy(e), c && c.copy(i), p < h))
|
|
718
718
|
return Math.sqrt(p);
|
|
@@ -721,7 +721,7 @@ at.prototype.distanceToBox = function() {
|
|
|
721
721
|
return Math.sqrt(f);
|
|
722
722
|
};
|
|
723
723
|
}();
|
|
724
|
-
class
|
|
724
|
+
class gi {
|
|
725
725
|
constructor(s) {
|
|
726
726
|
this._getNewPrimitive = s, this._primitives = [];
|
|
727
727
|
}
|
|
@@ -733,13 +733,13 @@ class _i {
|
|
|
733
733
|
this._primitives.push(s);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
class Oo extends
|
|
736
|
+
class Oo extends gi {
|
|
737
737
|
constructor() {
|
|
738
738
|
super(() => new Ft());
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
const It = /* @__PURE__ */ new Oo();
|
|
742
|
-
function
|
|
742
|
+
function Et(l, s) {
|
|
743
743
|
return s[l + 15] === 65535;
|
|
744
744
|
}
|
|
745
745
|
function dt(l, s) {
|
|
@@ -771,7 +771,7 @@ class go {
|
|
|
771
771
|
}
|
|
772
772
|
const Z = new go();
|
|
773
773
|
let Yt, Ie;
|
|
774
|
-
const Jt = [], Ke = /* @__PURE__ */ new
|
|
774
|
+
const Jt = [], Ke = /* @__PURE__ */ new gi(() => new Ot());
|
|
775
775
|
function _o(l, s, t, e, i, o) {
|
|
776
776
|
Yt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Yt, Ie), Z.setBuffer(l._roots[s]);
|
|
777
777
|
const n = ai(0, l.geometry, t, e, i, o);
|
|
@@ -782,20 +782,20 @@ function _o(l, s, t, e, i, o) {
|
|
|
782
782
|
function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
783
783
|
const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
|
|
784
784
|
let h = l * 2;
|
|
785
|
-
if (
|
|
785
|
+
if (Et(h, a)) {
|
|
786
786
|
const E = dt(l, c), u = ft(h, a);
|
|
787
787
|
return K(l, r, Yt), e(E, u, !1, n, o + l, Yt);
|
|
788
788
|
} else {
|
|
789
789
|
let L = function(y) {
|
|
790
790
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
791
791
|
let B = y * 2;
|
|
792
|
-
for (; !
|
|
792
|
+
for (; !Et(B, U); )
|
|
793
793
|
y = pt(y), B = y * 2;
|
|
794
794
|
return dt(y, x);
|
|
795
795
|
}, w = function(y) {
|
|
796
796
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
797
797
|
let B = y * 2;
|
|
798
|
-
for (; !
|
|
798
|
+
for (; !Et(B, U); )
|
|
799
799
|
y = Ct(y, x), B = y * 2;
|
|
800
800
|
return dt(y, x) + ft(B, U);
|
|
801
801
|
};
|
|
@@ -807,9 +807,9 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
807
807
|
m = C, C = y, A = F;
|
|
808
808
|
}
|
|
809
809
|
A || (A = Yt, K(f, r, A));
|
|
810
|
-
const p =
|
|
810
|
+
const p = Et(f * 2, a), T = t(A, p, m, n + 1, o + f);
|
|
811
811
|
let O;
|
|
812
|
-
if (T ===
|
|
812
|
+
if (T === xi) {
|
|
813
813
|
const y = L(f), x = w(f) - y;
|
|
814
814
|
O = e(y, x, !0, n + 1, o + f, A);
|
|
815
815
|
} else
|
|
@@ -825,9 +825,9 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
825
825
|
if (O)
|
|
826
826
|
return !0;
|
|
827
827
|
F = Ie, K(R, r, F);
|
|
828
|
-
const _ =
|
|
828
|
+
const _ = Et(R * 2, a), S = t(F, _, C, n + 1, o + R);
|
|
829
829
|
let N;
|
|
830
|
-
if (S ===
|
|
830
|
+
if (S === xi) {
|
|
831
831
|
const y = L(R), x = w(R) - y;
|
|
832
832
|
N = e(y, x, !0, n + 1, o + R, F);
|
|
833
833
|
} else
|
|
@@ -862,7 +862,7 @@ function So(l, s, t = {}, e = 0, i = 1 / 0) {
|
|
|
862
862
|
const c = Math.sqrt(r);
|
|
863
863
|
return t.point ? t.point.copy(Hs) : t.point = Hs.clone(), t.distance = c, t.faceIndex = a, t;
|
|
864
864
|
}
|
|
865
|
-
const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(),
|
|
865
|
+
const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), Vi = /* @__PURE__ */ new M(), Gi = /* @__PURE__ */ new M(), zi = /* @__PURE__ */ new M(), es = /* @__PURE__ */ new M();
|
|
866
866
|
function No(l, s, t, e, i, o) {
|
|
867
867
|
let n;
|
|
868
868
|
return o === Zn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== Ln, i), n === null ? null : {
|
|
@@ -874,7 +874,7 @@ function Po(l, s, t, e, i, o, n, r, a) {
|
|
|
874
874
|
te.fromBufferAttribute(s, o), ee.fromBufferAttribute(s, n), se.fromBufferAttribute(s, r);
|
|
875
875
|
const c = No(l, te, ee, se, es, a);
|
|
876
876
|
if (c) {
|
|
877
|
-
e && ($e.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (
|
|
877
|
+
e && ($e.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Vi, Gi, zi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
|
|
878
878
|
const h = {
|
|
879
879
|
a: o,
|
|
880
880
|
b: n,
|
|
@@ -959,9 +959,9 @@ function wo(l, s = null) {
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
|
-
const
|
|
962
|
+
const Hi = /* @__PURE__ */ new Ot();
|
|
963
963
|
function Gt(l, s, t, e) {
|
|
964
|
-
return K(l, s,
|
|
964
|
+
return K(l, s, Hi), t.intersectBox(Hi, e);
|
|
965
965
|
}
|
|
966
966
|
function Do(l, s, t, e, i, o) {
|
|
967
967
|
const { geometry: n, _indirectBuffer: r } = l;
|
|
@@ -988,23 +988,23 @@ function xo(l, s, t, e, i, o, n) {
|
|
|
988
988
|
}
|
|
989
989
|
return !1;
|
|
990
990
|
}
|
|
991
|
-
const
|
|
991
|
+
const ki = /* @__PURE__ */ new M();
|
|
992
992
|
function bo(l, s, t, e, i) {
|
|
993
993
|
Z.setBuffer(l._roots[s]), ci(0, l, t, e, i), Z.clearBuffer();
|
|
994
994
|
}
|
|
995
995
|
function ci(l, s, t, e, i) {
|
|
996
996
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
997
|
-
if (
|
|
997
|
+
if (Et(a, n)) {
|
|
998
998
|
const h = dt(l, r), d = ft(a, n);
|
|
999
999
|
Lo(s, t, e, h, d, i);
|
|
1000
1000
|
} else {
|
|
1001
1001
|
const h = pt(l);
|
|
1002
|
-
Gt(h, o, e,
|
|
1002
|
+
Gt(h, o, e, ki) && ci(h, s, t, e, i);
|
|
1003
1003
|
const d = Ct(l, r);
|
|
1004
|
-
Gt(d, o, e,
|
|
1004
|
+
Gt(d, o, e, ki) && ci(d, s, t, e, i);
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
const
|
|
1007
|
+
const Wi = /* @__PURE__ */ new M(), vo = ["x", "y", "z"];
|
|
1008
1008
|
function Bo(l, s, t, e) {
|
|
1009
1009
|
Z.setBuffer(l._roots[s]);
|
|
1010
1010
|
const i = li(0, l, t, e);
|
|
@@ -1013,14 +1013,14 @@ function Bo(l, s, t, e) {
|
|
|
1013
1013
|
function li(l, s, t, e) {
|
|
1014
1014
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1015
1015
|
let r = l * 2;
|
|
1016
|
-
if (
|
|
1016
|
+
if (Et(r, o)) {
|
|
1017
1017
|
const c = dt(l, n), h = ft(r, o);
|
|
1018
1018
|
return yo(s, t, e, c, h);
|
|
1019
1019
|
} else {
|
|
1020
1020
|
const c = Un(l, n), h = vo[c], E = e.direction[h] >= 0;
|
|
1021
1021
|
let u, f;
|
|
1022
1022
|
E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
|
|
1023
|
-
const m = Gt(u, i, e,
|
|
1023
|
+
const m = Gt(u, i, e, Wi) ? li(u, s, t, e) : null;
|
|
1024
1024
|
if (m) {
|
|
1025
1025
|
const F = m.point[h];
|
|
1026
1026
|
if (E ? F <= i[f + c] : (
|
|
@@ -1029,11 +1029,11 @@ function li(l, s, t, e) {
|
|
|
1029
1029
|
))
|
|
1030
1030
|
return m;
|
|
1031
1031
|
}
|
|
1032
|
-
const A = Gt(f, i, e,
|
|
1032
|
+
const A = Gt(f, i, e, Wi) ? li(f, s, t, e) : null;
|
|
1033
1033
|
return m && A ? m.distance <= A.distance ? m : A : m || A || null;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
const ss = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), Fe = /* @__PURE__ */ new yt(),
|
|
1036
|
+
const ss = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), Fe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
|
|
1037
1037
|
function Yo(l, s, t, e) {
|
|
1038
1038
|
Z.setBuffer(l._roots[s]);
|
|
1039
1039
|
const i = hi(0, l, t, e);
|
|
@@ -1042,7 +1042,7 @@ function Yo(l, s, t, e) {
|
|
|
1042
1042
|
function hi(l, s, t, e, i = null) {
|
|
1043
1043
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1044
1044
|
let a = l * 2;
|
|
1045
|
-
if (i === null && (t.boundingBox || t.computeBoundingBox(),
|
|
1045
|
+
if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, e), i = Xi), Et(a, n)) {
|
|
1046
1046
|
const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
|
|
1047
1047
|
if (Fe.copy(e).invert(), t.boundsTree)
|
|
1048
1048
|
return K(l, o, is), is.matrix.copy(Fe), is.needsUpdate = !0, t.boundsTree.shapecast({
|
|
@@ -1151,23 +1151,23 @@ function Wo(l, s = null) {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
const
|
|
1154
|
+
const Zi = /* @__PURE__ */ new M();
|
|
1155
1155
|
function Xo(l, s, t, e, i) {
|
|
1156
1156
|
Z.setBuffer(l._roots[s]), Ei(0, l, t, e, i), Z.clearBuffer();
|
|
1157
1157
|
}
|
|
1158
1158
|
function Ei(l, s, t, e, i) {
|
|
1159
1159
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
1160
|
-
if (
|
|
1160
|
+
if (Et(a, n)) {
|
|
1161
1161
|
const h = dt(l, r), d = ft(a, n);
|
|
1162
1162
|
Do(s, t, e, h, d, i);
|
|
1163
1163
|
} else {
|
|
1164
1164
|
const h = pt(l);
|
|
1165
|
-
Gt(h, o, e,
|
|
1165
|
+
Gt(h, o, e, Zi) && Ei(h, s, t, e, i);
|
|
1166
1166
|
const d = Ct(l, r);
|
|
1167
|
-
Gt(d, o, e,
|
|
1167
|
+
Gt(d, o, e, Zi) && Ei(d, s, t, e, i);
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
|
-
const
|
|
1170
|
+
const Qi = /* @__PURE__ */ new M(), Zo = ["x", "y", "z"];
|
|
1171
1171
|
function Qo(l, s, t, e) {
|
|
1172
1172
|
Z.setBuffer(l._roots[s]);
|
|
1173
1173
|
const i = di(0, l, t, e);
|
|
@@ -1176,14 +1176,14 @@ function Qo(l, s, t, e) {
|
|
|
1176
1176
|
function di(l, s, t, e) {
|
|
1177
1177
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1178
1178
|
let r = l * 2;
|
|
1179
|
-
if (
|
|
1179
|
+
if (Et(r, o)) {
|
|
1180
1180
|
const c = dt(l, n), h = ft(r, o);
|
|
1181
1181
|
return Uo(s, t, e, c, h);
|
|
1182
1182
|
} else {
|
|
1183
1183
|
const c = Un(l, n), h = Zo[c], E = e.direction[h] >= 0;
|
|
1184
1184
|
let u, f;
|
|
1185
1185
|
E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
|
|
1186
|
-
const m = Gt(u, i, e,
|
|
1186
|
+
const m = Gt(u, i, e, Qi) ? di(u, s, t, e) : null;
|
|
1187
1187
|
if (m) {
|
|
1188
1188
|
const F = m.point[h];
|
|
1189
1189
|
if (E ? F <= i[f + c] : (
|
|
@@ -1192,11 +1192,11 @@ function di(l, s, t, e) {
|
|
|
1192
1192
|
))
|
|
1193
1193
|
return m;
|
|
1194
1194
|
}
|
|
1195
|
-
const A = Gt(f, i, e,
|
|
1195
|
+
const A = Gt(f, i, e, Qi) ? di(f, s, t, e) : null;
|
|
1196
1196
|
return m && A ? m.distance <= A.distance ? m : A : m || A || null;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
const os = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), ge = /* @__PURE__ */ new yt(),
|
|
1199
|
+
const os = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), ge = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
|
|
1200
1200
|
function jo(l, s, t, e) {
|
|
1201
1201
|
Z.setBuffer(l._roots[s]);
|
|
1202
1202
|
const i = ui(0, l, t, e);
|
|
@@ -1205,7 +1205,7 @@ function jo(l, s, t, e) {
|
|
|
1205
1205
|
function ui(l, s, t, e, i = null) {
|
|
1206
1206
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1207
1207
|
let a = l * 2;
|
|
1208
|
-
if (i === null && (t.boundingBox || t.computeBoundingBox(),
|
|
1208
|
+
if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), Et(a, n)) {
|
|
1209
1209
|
const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
|
|
1210
1210
|
if (ge.copy(e).invert(), t.boundsTree)
|
|
1211
1211
|
return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
|
|
@@ -1281,7 +1281,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1281
1281
|
function er() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
1283
1283
|
}
|
|
1284
|
-
const xe = new Z.constructor(), As = new Z.constructor(), vt = new
|
|
1284
|
+
const xe = new Z.constructor(), As = new Z.constructor(), vt = new gi(() => new Ot()), ae = new Ot(), ce = new Ot(), Xs = new Ot(), Zs = new Ot();
|
|
1285
1285
|
let Qs = !1;
|
|
1286
1286
|
function sr(l, s, t, e) {
|
|
1287
1287
|
if (Qs)
|
|
@@ -1315,7 +1315,7 @@ function sr(l, s, t, e) {
|
|
|
1315
1315
|
function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
1316
1316
|
let d, E;
|
|
1317
1317
|
h ? (d = As, E = xe) : (d = xe, E = As);
|
|
1318
|
-
const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T =
|
|
1318
|
+
const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R), O = Et(p, A);
|
|
1319
1319
|
let _ = !1;
|
|
1320
1320
|
if (O && T)
|
|
1321
1321
|
h ? _ = i(
|
|
@@ -1495,8 +1495,8 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
return _;
|
|
1497
1497
|
}
|
|
1498
|
-
const cs = /* @__PURE__ */ new at(),
|
|
1499
|
-
class
|
|
1498
|
+
const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new Ot();
|
|
1499
|
+
class _i {
|
|
1500
1500
|
static serialize(s, t = {}) {
|
|
1501
1501
|
t = {
|
|
1502
1502
|
cloneBuffers: !0,
|
|
@@ -1520,7 +1520,7 @@ class Si {
|
|
|
1520
1520
|
indirect: !!s.indirectBuffer,
|
|
1521
1521
|
...e
|
|
1522
1522
|
};
|
|
1523
|
-
const { index: i, roots: o, indirectBuffer: n } = s, r = new
|
|
1523
|
+
const { index: i, roots: o, indirectBuffer: n } = s, r = new _i(t, { ...e, [Vs]: !0 });
|
|
1524
1524
|
if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
|
|
1525
1525
|
const a = t.getIndex();
|
|
1526
1526
|
if (a === null) {
|
|
@@ -1576,7 +1576,7 @@ class Si {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
/* Core Cast Functions */
|
|
1579
|
-
raycast(s, t =
|
|
1579
|
+
raycast(s, t = wi) {
|
|
1580
1580
|
const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Xo : bo;
|
|
1581
1581
|
for (let d = 0, E = e.length; d < E; d++) {
|
|
1582
1582
|
const u = r ? t[a[d].materialIndex].side : c, f = o.length;
|
|
@@ -1588,7 +1588,7 @@ class Si {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
return o;
|
|
1590
1590
|
}
|
|
1591
|
-
raycastFirst(s, t =
|
|
1591
|
+
raycastFirst(s, t = wi) {
|
|
1592
1592
|
const e = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
|
|
1593
1593
|
let r = null;
|
|
1594
1594
|
const a = i.groups, c = o ? t.side : t, h = this.indirect ? Qo : Bo;
|
|
@@ -1703,27 +1703,27 @@ class Si {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
getBoundingBox(s) {
|
|
1705
1705
|
return s.makeEmpty(), this._roots.forEach((e) => {
|
|
1706
|
-
K(0, new Float32Array(e),
|
|
1706
|
+
K(0, new Float32Array(e), qi), s.union(qi);
|
|
1707
1707
|
}), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function Ki(l, s, t) {
|
|
1711
1711
|
return l === null || (l.point.applyMatrix4(s.matrixWorld), l.distance = l.point.distanceTo(t.ray.origin), l.object = s, l.distance < t.near || l.distance > t.far) ? null : l;
|
|
1712
1712
|
}
|
|
1713
|
-
const js = /* @__PURE__ */ new Qn(),
|
|
1713
|
+
const js = /* @__PURE__ */ new Qn(), $i = /* @__PURE__ */ new yt(), ir = v.prototype.raycast;
|
|
1714
1714
|
function nr(l, s) {
|
|
1715
1715
|
if (this.geometry.boundsTree) {
|
|
1716
1716
|
if (this.material === void 0)
|
|
1717
1717
|
return;
|
|
1718
|
-
|
|
1718
|
+
$i.copy(this.matrixWorld).invert(), js.copy(l.ray).applyMatrix4($i);
|
|
1719
1719
|
const t = this.geometry.boundsTree;
|
|
1720
1720
|
if (l.firstHitOnly === !0) {
|
|
1721
|
-
const e =
|
|
1721
|
+
const e = Ki(t.raycastFirst(js, this.material), this, l);
|
|
1722
1722
|
e && s.push(e);
|
|
1723
1723
|
} else {
|
|
1724
1724
|
const e = t.raycast(js, this.material);
|
|
1725
1725
|
for (let i = 0, o = e.length; i < o; i++) {
|
|
1726
|
-
const n =
|
|
1726
|
+
const n = Ki(e[i], this, l);
|
|
1727
1727
|
n && s.push(n);
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
@@ -1731,7 +1731,7 @@ function nr(l, s) {
|
|
|
1731
1731
|
ir.call(this, l, s);
|
|
1732
1732
|
}
|
|
1733
1733
|
function or(l) {
|
|
1734
|
-
return this.boundsTree = new
|
|
1734
|
+
return this.boundsTree = new _i(this, l), this.boundsTree;
|
|
1735
1735
|
}
|
|
1736
1736
|
function rr() {
|
|
1737
1737
|
this.boundsTree = null;
|
|
@@ -1794,7 +1794,7 @@ class Ts {
|
|
|
1794
1794
|
this.handlers.length = 0;
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
|
-
class
|
|
1797
|
+
class Si {
|
|
1798
1798
|
constructor(s) {
|
|
1799
1799
|
/** Whether is component is {@link Disposable}. */
|
|
1800
1800
|
I(this, "isDisposeable", () => "dispose" in this && "onDisposed" in this);
|
|
@@ -1809,9 +1809,9 @@ class Ni {
|
|
|
1809
1809
|
this.components = s;
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
class et extends
|
|
1812
|
+
class et extends Si {
|
|
1813
1813
|
}
|
|
1814
|
-
class
|
|
1814
|
+
class Ni extends Si {
|
|
1815
1815
|
constructor(t) {
|
|
1816
1816
|
super(t);
|
|
1817
1817
|
I(this, "worlds", /* @__PURE__ */ new Map());
|
|
@@ -1829,7 +1829,7 @@ class Pi extends Ni {
|
|
|
1829
1829
|
});
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
|
-
class ar extends
|
|
1832
|
+
class ar extends Ni {
|
|
1833
1833
|
constructor() {
|
|
1834
1834
|
super(...arguments);
|
|
1835
1835
|
/**
|
|
@@ -1840,7 +1840,7 @@ class ar extends Pi {
|
|
|
1840
1840
|
I(this, "hasCameraControls", () => "controls" in this);
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
|
-
class cr extends
|
|
1843
|
+
class cr extends Ni {
|
|
1844
1844
|
constructor() {
|
|
1845
1845
|
super(...arguments);
|
|
1846
1846
|
/** {@link Updateable.onBeforeUpdate} */
|
|
@@ -1958,7 +1958,7 @@ const be = class be extends et {
|
|
|
1958
1958
|
*/
|
|
1959
1959
|
I(be, "uuid", "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");
|
|
1960
1960
|
let zt = be;
|
|
1961
|
-
class lr extends
|
|
1961
|
+
class lr extends Ni {
|
|
1962
1962
|
constructor(t) {
|
|
1963
1963
|
super(t);
|
|
1964
1964
|
/** {@link Disposable.onDisposed} */
|
|
@@ -1974,10 +1974,10 @@ class lr extends Pi {
|
|
|
1974
1974
|
this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
|
-
const ms = 0, hr = 1, Er = new M(),
|
|
1977
|
+
const ms = 0, hr = 1, Er = new M(), Ji = new Lt(), qs = new Fi(), tn = new M(), ls = new ue();
|
|
1978
1978
|
class dr {
|
|
1979
1979
|
constructor() {
|
|
1980
|
-
this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new
|
|
1980
|
+
this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new en(), this.unassigned = new en(), this.vertices = [];
|
|
1981
1981
|
}
|
|
1982
1982
|
setFromPoints(s) {
|
|
1983
1983
|
if (s.length >= 4) {
|
|
@@ -2107,12 +2107,12 @@ class dr {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
const r = e[n], a = i[n];
|
|
2109
2109
|
let c, h;
|
|
2110
|
-
o = 0,
|
|
2110
|
+
o = 0, Ji.set(r.point, a.point);
|
|
2111
2111
|
for (let E = 0, u = this.vertices.length; E < u; E++) {
|
|
2112
2112
|
const f = s[E];
|
|
2113
2113
|
if (f !== r && f !== a) {
|
|
2114
|
-
|
|
2115
|
-
const R =
|
|
2114
|
+
Ji.closestPointToPoint(f.point, !0, tn);
|
|
2115
|
+
const R = tn.distanceToSquared(f.point);
|
|
2116
2116
|
R > o && (o = R, c = f);
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
@@ -2281,7 +2281,7 @@ class ur {
|
|
|
2281
2281
|
this.point = s, this.prev = null, this.next = null, this.face = null;
|
|
2282
2282
|
}
|
|
2283
2283
|
}
|
|
2284
|
-
class
|
|
2284
|
+
class en {
|
|
2285
2285
|
constructor() {
|
|
2286
2286
|
this.head = null, this.tail = null;
|
|
2287
2287
|
}
|
|
@@ -2418,12 +2418,12 @@ function Tr(l) {
|
|
|
2418
2418
|
We.makeScale(Ht * 2, kt * 2, Wt * 2);
|
|
2419
2419
|
const Ce = new g.Matrix4();
|
|
2420
2420
|
Ce.makeTranslation(-Ht, -kt, -Wt);
|
|
2421
|
+
const yi = new g.Matrix4();
|
|
2422
|
+
yi.makeTranslation(q.x, q.y, q.z);
|
|
2421
2423
|
const Mi = new g.Matrix4();
|
|
2422
|
-
Mi.
|
|
2423
|
-
const wi = new g.Matrix4();
|
|
2424
|
-
wi.setFromMatrix3(Q);
|
|
2424
|
+
Mi.setFromMatrix3(Q);
|
|
2425
2425
|
const Te = new g.Matrix4();
|
|
2426
|
-
return Te.multiply(
|
|
2426
|
+
return Te.multiply(yi), Te.multiply(Mi), Te.multiply(Ce), Te.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: Te };
|
|
2427
2427
|
}
|
|
2428
2428
|
function mr(l, s, t) {
|
|
2429
2429
|
const e = [
|
|
@@ -2433,7 +2433,7 @@ function mr(l, s, t) {
|
|
|
2433
2433
|
];
|
|
2434
2434
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
|
|
2435
2435
|
}
|
|
2436
|
-
class
|
|
2436
|
+
class sn {
|
|
2437
2437
|
static isTransparent(s) {
|
|
2438
2438
|
return s.transparent && s.opacity < 1;
|
|
2439
2439
|
}
|
|
@@ -2964,7 +2964,7 @@ const Fs = class Fs {
|
|
|
2964
2964
|
/**
|
|
2965
2965
|
* The version of the @thatopen/components library.
|
|
2966
2966
|
*/
|
|
2967
|
-
I(Fs, "release", "2.0
|
|
2967
|
+
I(Fs, "release", "2.1.0");
|
|
2968
2968
|
let pi = Fs;
|
|
2969
2969
|
class Rr {
|
|
2970
2970
|
constructor(s) {
|
|
@@ -3127,7 +3127,7 @@ const Os = class Os extends et {
|
|
|
3127
3127
|
*/
|
|
3128
3128
|
I(Os, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
|
|
3129
3129
|
let ze = Os;
|
|
3130
|
-
class Fr extends
|
|
3130
|
+
class Fr extends Si {
|
|
3131
3131
|
constructor() {
|
|
3132
3132
|
super(...arguments);
|
|
3133
3133
|
/**
|
|
@@ -3404,7 +3404,7 @@ function Zt(l) {
|
|
|
3404
3404
|
function bt(l) {
|
|
3405
3405
|
return l.isOrthographicCamera;
|
|
3406
3406
|
}
|
|
3407
|
-
const he = Math.PI * 2,
|
|
3407
|
+
const he = Math.PI * 2, nn = Math.PI / 2, xn = 1e-5, Se = Math.PI / 180;
|
|
3408
3408
|
function mt(l, s, t) {
|
|
3409
3409
|
return Math.max(s, Math.min(t, l));
|
|
3410
3410
|
}
|
|
@@ -3414,7 +3414,7 @@ function X(l, s = xn) {
|
|
|
3414
3414
|
function k(l, s, t = xn) {
|
|
3415
3415
|
return X(l - s, t);
|
|
3416
3416
|
}
|
|
3417
|
-
function
|
|
3417
|
+
function on(l, s) {
|
|
3418
3418
|
return Math.round(l / s) * s;
|
|
3419
3419
|
}
|
|
3420
3420
|
function Ne(l) {
|
|
@@ -3434,7 +3434,7 @@ function hs(l, s, t, e, i = 1 / 0, o) {
|
|
|
3434
3434
|
let u = s + (c + E) * a;
|
|
3435
3435
|
return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
|
|
3436
3436
|
}
|
|
3437
|
-
function
|
|
3437
|
+
function rn(l, s, t, e, i = 1 / 0, o, n) {
|
|
3438
3438
|
e = Math.max(1e-4, e);
|
|
3439
3439
|
const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3440
3440
|
let h = s.x, d = s.y, E = s.z, u = l.x - h, f = l.y - d, R = l.z - E;
|
|
@@ -3522,7 +3522,7 @@ class Or {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
}
|
|
3524
3524
|
const gr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
|
|
3525
|
-
let Y,
|
|
3525
|
+
let Y, an, ds, ti, lt, G, z, Ee, Le, gt, _t, Qt, cn, ln, ut, ye, de, hn, ei, En, si, ii, us;
|
|
3526
3526
|
class ot extends Or {
|
|
3527
3527
|
/**
|
|
3528
3528
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
@@ -3565,7 +3565,7 @@ class ot extends Or {
|
|
|
3565
3565
|
* @category Statics
|
|
3566
3566
|
*/
|
|
3567
3567
|
static install(s) {
|
|
3568
|
-
Y = s.THREE,
|
|
3568
|
+
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), gt = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), ut = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), hn = new Y.Box3(), ei = new Y.Sphere(), En = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
|
|
3569
3569
|
}
|
|
3570
3570
|
/**
|
|
3571
3571
|
* list all ACTIONs
|
|
@@ -4201,11 +4201,11 @@ class ot extends Or {
|
|
|
4201
4201
|
fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
4202
4202
|
const a = [], c = s.isBox3 ? de.copy(s) : de.setFromObject(s);
|
|
4203
4203
|
c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
4204
|
-
const h =
|
|
4204
|
+
const h = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
|
|
4205
4205
|
a.push(this.rotateTo(h, d, t));
|
|
4206
|
-
const E = G.setFromSpherical(this._sphericalEnd).normalize(), u =
|
|
4206
|
+
const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), f = k(Math.abs(E.y), 1);
|
|
4207
4207
|
f && u.multiply(si.setFromAxisAngle(ds, h)), u.multiply(this._yAxisUpSpaceInverse);
|
|
4208
|
-
const R =
|
|
4208
|
+
const R = hn.makeEmpty();
|
|
4209
4209
|
z.copy(c.min).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(ti, E), f && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
|
|
4210
4210
|
const m = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
|
|
4211
4211
|
if (Zt(this._camera)) {
|
|
@@ -4481,7 +4481,7 @@ class ot extends Or {
|
|
|
4481
4481
|
* @category Methods
|
|
4482
4482
|
*/
|
|
4483
4483
|
update(s) {
|
|
4484
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, e = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, o =
|
|
4484
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, e = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, o = cn.subVectors(this._targetEnd, this._target), n = ln.subVectors(this._focalOffsetEnd, this._focalOffset), r = this._zoomEnd - this._zoom;
|
|
4485
4485
|
if (X(t))
|
|
4486
4486
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
4487
4487
|
else {
|
|
@@ -4504,13 +4504,13 @@ class ot extends Or {
|
|
|
4504
4504
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
4505
4505
|
else {
|
|
4506
4506
|
const d = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
4507
|
-
|
|
4507
|
+
rn(this._target, this._targetEnd, this._targetVelocity, d, this.maxSpeed, s, this._target), this._needsUpdate = !0;
|
|
4508
4508
|
}
|
|
4509
4509
|
if (X(n.x) && X(n.y) && X(n.z))
|
|
4510
4510
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
4511
4511
|
else {
|
|
4512
4512
|
const d = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
4513
|
-
|
|
4513
|
+
rn(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, d, this.maxSpeed, s, this._focalOffset), this._needsUpdate = !0;
|
|
4514
4514
|
}
|
|
4515
4515
|
if (X(r))
|
|
4516
4516
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
@@ -4657,7 +4657,7 @@ class ot extends Or {
|
|
|
4657
4657
|
if (!(this.colliderMeshes.length >= 1) || Js(this._camera, "_collisionTest"))
|
|
4658
4658
|
return s;
|
|
4659
4659
|
const e = this._getTargetDirection(Le);
|
|
4660
|
-
ii.lookAt(
|
|
4660
|
+
ii.lookAt(an, e, this._camera.up);
|
|
4661
4661
|
for (let i = 0; i < 4; i++) {
|
|
4662
4662
|
const o = z.copy(this._nearPlaneCorners[i]);
|
|
4663
4663
|
o.applyMatrix4(ii);
|
|
@@ -5157,12 +5157,12 @@ const _s = class _s extends et {
|
|
|
5157
5157
|
* This UUID is used to register the component within the Components system.
|
|
5158
5158
|
*/
|
|
5159
5159
|
I(_s, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
|
|
5160
|
-
let
|
|
5161
|
-
const jt = new jn(), nt = new M(), xt = new M(), j = new Pt(),
|
|
5160
|
+
let dn = _s;
|
|
5161
|
+
const jt = new jn(), nt = new M(), xt = new M(), j = new Pt(), un = {
|
|
5162
5162
|
X: new M(1, 0, 0),
|
|
5163
5163
|
Y: new M(0, 1, 0),
|
|
5164
5164
|
Z: new M(0, 0, 1)
|
|
5165
|
-
}, ni = { type: "change" },
|
|
5165
|
+
}, ni = { type: "change" }, In = { type: "mouseDown" }, fn = { type: "mouseUp", mode: null }, pn = { type: "objectChange" };
|
|
5166
5166
|
class Pr extends ri {
|
|
5167
5167
|
constructor(s, t) {
|
|
5168
5168
|
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
@@ -5201,7 +5201,7 @@ class Pr extends ri {
|
|
|
5201
5201
|
if (!(this.object === void 0 || this.dragging === !0 || s.button !== 0) && this.axis !== null) {
|
|
5202
5202
|
jt.setFromCamera(s, this.camera);
|
|
5203
5203
|
const t = oi(this._plane, jt, !0);
|
|
5204
|
-
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0,
|
|
5204
|
+
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, In.mode = this.mode, this.dispatchEvent(In);
|
|
5205
5205
|
}
|
|
5206
5206
|
}
|
|
5207
5207
|
pointerMove(s) {
|
|
@@ -5225,13 +5225,13 @@ class Pr extends ri {
|
|
|
5225
5225
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
5226
5226
|
const r = 20 / this.worldPosition.distanceTo(nt.setFromMatrixPosition(this.camera.matrixWorld));
|
|
5227
5227
|
let a = !1;
|
|
5228
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye)) * r) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(
|
|
5228
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye)) * r) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(un[t]), nt.copy(un[t]), o === "local" && nt.applyQuaternion(this.worldQuaternion), nt.cross(this.eye), nt.length() === 0 ? a = !0 : this.rotationAngle = this._offset.dot(nt.normalize()) * r), (t === "E" || a) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), o === "local" && t !== "E" && t !== "XYZE" ? (i.quaternion.copy(this._quaternionStart), i.quaternion.multiply(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), i.quaternion.copy(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), i.quaternion.multiply(this._quaternionStart).normalize());
|
|
5229
5229
|
}
|
|
5230
|
-
this.dispatchEvent(ni), this.dispatchEvent(
|
|
5230
|
+
this.dispatchEvent(ni), this.dispatchEvent(pn);
|
|
5231
5231
|
}
|
|
5232
5232
|
}
|
|
5233
5233
|
pointerUp(s) {
|
|
5234
|
-
s.button === 0 && (this.dragging && this.axis !== null && (
|
|
5234
|
+
s.button === 0 && (this.dragging && this.axis !== null && (fn.mode = this.mode, this.dispatchEvent(fn)), this.dragging = !1, this.axis = null);
|
|
5235
5235
|
}
|
|
5236
5236
|
dispose() {
|
|
5237
5237
|
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.traverse(function(s) {
|
|
@@ -5247,7 +5247,7 @@ class Pr extends ri {
|
|
|
5247
5247
|
return this.object = void 0, this.visible = !1, this.axis = null, this;
|
|
5248
5248
|
}
|
|
5249
5249
|
reset() {
|
|
5250
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ni), this.dispatchEvent(
|
|
5250
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ni), this.dispatchEvent(pn), this.pointStart.copy(this.pointEnd));
|
|
5251
5251
|
}
|
|
5252
5252
|
getRaycaster() {
|
|
5253
5253
|
return jt;
|
|
@@ -5316,7 +5316,7 @@ function oi(l, s, t) {
|
|
|
5316
5316
|
return e[i];
|
|
5317
5317
|
return !1;
|
|
5318
5318
|
}
|
|
5319
|
-
const Is = new qn(), W = new M(0, 1, 0),
|
|
5319
|
+
const Is = new qn(), W = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new yt(), fs = new Pt(), Rs = new Pt(), St = new M(), mn = new yt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), ps = new M(), Me = new M(), we = new M();
|
|
5320
5320
|
class Ur extends ri {
|
|
5321
5321
|
constructor() {
|
|
5322
5322
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -5358,8 +5358,8 @@ class Ur extends ri {
|
|
|
5358
5358
|
R.translate(0, 0.05, 0);
|
|
5359
5359
|
const m = new rt(0.08, 0.08, 0.08);
|
|
5360
5360
|
m.translate(0, 0.04, 0);
|
|
5361
|
-
const C = new
|
|
5362
|
-
C.setAttribute("position", new
|
|
5361
|
+
const C = new Di();
|
|
5362
|
+
C.setAttribute("position", new Ui([0, 0, 0, 1, 0, 0], 3));
|
|
5363
5363
|
const A = new ct(75e-4, 75e-4, 0.5, 3);
|
|
5364
5364
|
A.translate(0, 0.25, 0);
|
|
5365
5365
|
function F(B, H) {
|
|
@@ -5367,8 +5367,8 @@ class Ur extends ri {
|
|
|
5367
5367
|
return q.rotateY(Math.PI / 2), q.rotateX(Math.PI / 2), q;
|
|
5368
5368
|
}
|
|
5369
5369
|
function p() {
|
|
5370
|
-
const B = new
|
|
5371
|
-
return B.setAttribute("position", new
|
|
5370
|
+
const B = new Di();
|
|
5371
|
+
return B.setAttribute("position", new Ui([0, 0, 0, 1, 1, 1], 3)), B;
|
|
5372
5372
|
}
|
|
5373
5373
|
const T = {
|
|
5374
5374
|
X: [
|
|
@@ -5566,10 +5566,10 @@ class Ur extends ri {
|
|
|
5566
5566
|
n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
|
|
5567
5567
|
let r;
|
|
5568
5568
|
if (this.camera.isOrthographicCamera ? r = (this.camera.top - this.camera.bottom) / this.camera.zoom : r = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(r * this.size / 4), n.tag === "helper") {
|
|
5569
|
-
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(
|
|
5569
|
+
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Tn.lookAt(Cn, W, qt)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
|
|
5570
5570
|
continue;
|
|
5571
5571
|
}
|
|
5572
|
-
n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(
|
|
5572
|
+
n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Tn.lookAt(this.eye, Cn, qt)), n.name === "X" && (j.setFromAxisAngle(De, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(W.x, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(Ue, Math.atan2(W.y, W.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
|
|
5573
5573
|
return n.name === a;
|
|
5574
5574
|
})) && (n.material.color.setHex(16776960), n.material.opacity = 1);
|
|
5575
5575
|
}
|
|
@@ -5617,10 +5617,10 @@ class xr extends v {
|
|
|
5617
5617
|
default:
|
|
5618
5618
|
St.set(0, 0, 0);
|
|
5619
5619
|
}
|
|
5620
|
-
St.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (
|
|
5620
|
+
St.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (mn.lookAt(nt.set(0, 0, 0), St, W), this.quaternion.setFromRotationMatrix(mn)), super.updateMatrixWorld(s);
|
|
5621
5621
|
}
|
|
5622
5622
|
}
|
|
5623
|
-
class
|
|
5623
|
+
class Pi {
|
|
5624
5624
|
constructor(s, t, e, i, o, n = 5, r = !0) {
|
|
5625
5625
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5626
5626
|
I(this, "onDraggingStarted", new D());
|
|
@@ -5666,7 +5666,7 @@ class Li {
|
|
|
5666
5666
|
});
|
|
5667
5667
|
if (this.components = s, this.world = t, !t.renderer)
|
|
5668
5668
|
throw new Error("The given world must have a renderer!");
|
|
5669
|
-
this.normal = i, this.origin = e, t.renderer.setPlane(!0, this.three), this._planeMesh =
|
|
5669
|
+
this.normal = i, this.origin = e, t.renderer.setPlane(!0, this.three), this._planeMesh = Pi.newPlaneMesh(n, o), this._helper = this.newHelper(), this._controls = this.newTransformControls(), this.three.setFromNormalAndCoplanarPoint(i, e), r && this.toggleControls(!0);
|
|
5670
5670
|
}
|
|
5671
5671
|
/**
|
|
5672
5672
|
* Getter for the enabled state of the clipping plane.
|
|
@@ -5832,7 +5832,7 @@ const ve = class ve extends et {
|
|
|
5832
5832
|
* The type of clipping plane to be created.
|
|
5833
5833
|
* Default is {@link SimplePlane}.
|
|
5834
5834
|
*/
|
|
5835
|
-
I(this, "Type",
|
|
5835
|
+
I(this, "Type", Pi);
|
|
5836
5836
|
/**
|
|
5837
5837
|
* A list of all the clipping planes created by this component.
|
|
5838
5838
|
*/
|
|
@@ -6014,7 +6014,7 @@ const ve = class ve extends et {
|
|
|
6014
6014
|
* This UUID is used to register the component within the Components system.
|
|
6015
6015
|
*/
|
|
6016
6016
|
I(ve, "uuid", "66290bc5-18c4-4cd1-9379-2e17a0617611");
|
|
6017
|
-
let
|
|
6017
|
+
let Rn = ve;
|
|
6018
6018
|
function br(l, s, t, e) {
|
|
6019
6019
|
return new Promise((i, o) => {
|
|
6020
6020
|
function n() {
|
|
@@ -6253,13 +6253,13 @@ class Vr extends Yr {
|
|
|
6253
6253
|
let d = !0;
|
|
6254
6254
|
const E = [];
|
|
6255
6255
|
for (const u of o)
|
|
6256
|
-
|
|
6256
|
+
sn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
|
|
6257
6257
|
if (d) {
|
|
6258
6258
|
n.dispose(), this.isProcessing = !1;
|
|
6259
6259
|
return;
|
|
6260
6260
|
}
|
|
6261
6261
|
a = E;
|
|
6262
|
-
} else if (
|
|
6262
|
+
} else if (sn.isTransparent(o)) {
|
|
6263
6263
|
n.dispose(), this.isProcessing = !1;
|
|
6264
6264
|
return;
|
|
6265
6265
|
} else
|
|
@@ -6568,7 +6568,7 @@ const Ss = class Ss extends et {
|
|
|
6568
6568
|
* This UUID is used to register the component within the Components system.
|
|
6569
6569
|
*/
|
|
6570
6570
|
I(Ss, "uuid", "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");
|
|
6571
|
-
let
|
|
6571
|
+
let An = Ss;
|
|
6572
6572
|
class zr {
|
|
6573
6573
|
constructor(s) {
|
|
6574
6574
|
/** {@link NavigationMode.enabled} */
|
|
@@ -6829,427 +6829,326 @@ class na extends He {
|
|
|
6829
6829
|
this.threeOrtho.left = -a, this.threeOrtho.right = a, this.threeOrtho.top = r, this.threeOrtho.bottom = -r, this.threeOrtho.updateProjectionMatrix(), this.previousSize.copy(t);
|
|
6830
6830
|
}
|
|
6831
6831
|
}
|
|
6832
|
-
const
|
|
6832
|
+
const Xr = /* @__PURE__ */ new Map([
|
|
6833
|
+
[
|
|
6834
|
+
b.IFCRELAGGREGATES,
|
|
6835
|
+
{
|
|
6836
|
+
forRelating: "IsDecomposedBy",
|
|
6837
|
+
forRelated: "Decomposes"
|
|
6838
|
+
}
|
|
6839
|
+
],
|
|
6840
|
+
[
|
|
6841
|
+
b.IFCRELASSOCIATESMATERIAL,
|
|
6842
|
+
{
|
|
6843
|
+
forRelating: "AssociatedTo",
|
|
6844
|
+
forRelated: "HasAssociations"
|
|
6845
|
+
}
|
|
6846
|
+
],
|
|
6847
|
+
[
|
|
6848
|
+
b.IFCRELASSOCIATESCLASSIFICATION,
|
|
6849
|
+
{
|
|
6850
|
+
forRelating: "ClassificationForObjects",
|
|
6851
|
+
forRelated: "HasAssociations"
|
|
6852
|
+
}
|
|
6853
|
+
],
|
|
6854
|
+
[
|
|
6855
|
+
b.IFCRELASSIGNSTOGROUP,
|
|
6856
|
+
{
|
|
6857
|
+
forRelating: "IsGroupedBy",
|
|
6858
|
+
forRelated: "HasAssignments"
|
|
6859
|
+
}
|
|
6860
|
+
],
|
|
6861
|
+
[
|
|
6862
|
+
b.IFCRELDEFINESBYPROPERTIES,
|
|
6863
|
+
{
|
|
6864
|
+
forRelated: "IsDefinedBy",
|
|
6865
|
+
forRelating: "DefinesOcurrence"
|
|
6866
|
+
}
|
|
6867
|
+
],
|
|
6868
|
+
[
|
|
6869
|
+
b.IFCRELDEFINESBYTYPE,
|
|
6870
|
+
{
|
|
6871
|
+
forRelated: "IsTypedBy",
|
|
6872
|
+
forRelating: "Types"
|
|
6873
|
+
}
|
|
6874
|
+
],
|
|
6875
|
+
[
|
|
6876
|
+
b.IFCRELDEFINESBYTEMPLATE,
|
|
6877
|
+
{
|
|
6878
|
+
forRelated: "IsDefinedBy",
|
|
6879
|
+
forRelating: "Defines"
|
|
6880
|
+
}
|
|
6881
|
+
],
|
|
6882
|
+
[
|
|
6883
|
+
b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
6884
|
+
{
|
|
6885
|
+
forRelated: "ContainedInStructure",
|
|
6886
|
+
forRelating: "ContainsElements"
|
|
6887
|
+
}
|
|
6888
|
+
]
|
|
6889
|
+
]), Ye = class Ye extends et {
|
|
6833
6890
|
constructor(t) {
|
|
6834
6891
|
super(t);
|
|
6835
|
-
/** {@link Component.enabled} */
|
|
6836
|
-
I(this, "enabled", !0);
|
|
6837
6892
|
/** {@link Disposable.onDisposed} */
|
|
6838
6893
|
I(this, "onDisposed", new D());
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6894
|
+
/**
|
|
6895
|
+
* Event triggered when relations for a model have been indexed.
|
|
6896
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
6897
|
+
*
|
|
6898
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
6899
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
6900
|
+
* The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
6901
|
+
*/
|
|
6902
|
+
I(this, "onRelationsIndexed", new D());
|
|
6903
|
+
/**
|
|
6904
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
6905
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
6906
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
6907
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
6908
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
6909
|
+
* of entity relationships within a model.
|
|
6910
|
+
*/
|
|
6911
|
+
I(this, "relationMaps", {});
|
|
6912
|
+
/** {@link Component.enabled} */
|
|
6913
|
+
I(this, "enabled", !0);
|
|
6914
|
+
I(this, "_relToAttributesMap", Xr);
|
|
6915
|
+
I(this, "_inverseAttributes", [
|
|
6916
|
+
"IsDecomposedBy",
|
|
6917
|
+
"Decomposes",
|
|
6918
|
+
"AssociatedTo",
|
|
6919
|
+
"HasAssociations",
|
|
6920
|
+
"ClassificationForObjects",
|
|
6921
|
+
"IsGroupedBy",
|
|
6922
|
+
"HasAssignments",
|
|
6923
|
+
"IsDefinedBy",
|
|
6924
|
+
"DefinesOcurrence",
|
|
6925
|
+
"IsTypedBy",
|
|
6926
|
+
"Types",
|
|
6927
|
+
"Defines",
|
|
6928
|
+
"ContainedInStructure",
|
|
6929
|
+
"ContainsElements"
|
|
6930
|
+
]);
|
|
6931
|
+
I(this, "_ifcRels", [
|
|
6932
|
+
b.IFCRELAGGREGATES,
|
|
6933
|
+
b.IFCRELASSOCIATESMATERIAL,
|
|
6934
|
+
b.IFCRELASSOCIATESCLASSIFICATION,
|
|
6935
|
+
b.IFCRELASSIGNSTOGROUP,
|
|
6936
|
+
b.IFCRELDEFINESBYPROPERTIES,
|
|
6937
|
+
b.IFCRELDEFINESBYTYPE,
|
|
6938
|
+
b.IFCRELDEFINESBYTEMPLATE,
|
|
6939
|
+
b.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
6940
|
+
]);
|
|
6941
|
+
I(this, "onFragmentsDisposed", (t) => {
|
|
6942
|
+
delete this.relationMaps[t.groupID];
|
|
6943
|
+
});
|
|
6944
|
+
this.components.add(Ye.uuid, this), t.get(ht).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
6843
6945
|
}
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6946
|
+
indexRelations(t, e, i, o) {
|
|
6947
|
+
const n = Object.keys(e).find(
|
|
6948
|
+
(E) => E.startsWith("Relating")
|
|
6949
|
+
), r = Object.keys(e).find(
|
|
6950
|
+
(E) => E.startsWith("Related")
|
|
6951
|
+
);
|
|
6952
|
+
if (!(n && r))
|
|
6953
|
+
return;
|
|
6954
|
+
const a = e[n].value, c = e[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
|
|
6955
|
+
h.set(d, c), t.set(a, h);
|
|
6956
|
+
for (const E of c) {
|
|
6957
|
+
const u = t.get(E) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(i), R = u.get(f) ?? [];
|
|
6958
|
+
R.push(a), u.set(f, R), t.set(E, u);
|
|
6959
|
+
}
|
|
6853
6960
|
}
|
|
6854
6961
|
/**
|
|
6855
|
-
*
|
|
6856
|
-
*
|
|
6857
|
-
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
6858
|
-
* @returns A new THREE.Vector3 representing the boundary.
|
|
6859
|
-
*
|
|
6860
|
-
* @remarks
|
|
6861
|
-
* This method is used to create a new boundary for calculating bounding boxes.
|
|
6862
|
-
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
6863
|
-
* depending on the value of the `positive` parameter.
|
|
6962
|
+
* Adds a relation map to the model's relations map.
|
|
6864
6963
|
*
|
|
6865
|
-
* @
|
|
6866
|
-
*
|
|
6867
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
6868
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
6964
|
+
* @param model - The `FragmentsGroup` model to which the relation map will be added.
|
|
6965
|
+
* @param relationMap - The `RelationsMap` to be added to the model's relations map.
|
|
6869
6966
|
*
|
|
6870
|
-
*
|
|
6871
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
6872
|
-
* ```
|
|
6967
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
6873
6968
|
*/
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
e
|
|
6878
|
-
|
|
6879
|
-
e * Number.MAX_VALUE
|
|
6880
|
-
);
|
|
6969
|
+
setRelationMap(t, e) {
|
|
6970
|
+
this.relationMaps[t.uuid] = e, this.onRelationsIndexed.trigger({
|
|
6971
|
+
modelID: t.uuid,
|
|
6972
|
+
relationsMap: e
|
|
6973
|
+
});
|
|
6881
6974
|
}
|
|
6882
6975
|
/**
|
|
6883
|
-
*
|
|
6884
|
-
*
|
|
6885
|
-
*
|
|
6886
|
-
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
6887
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
6888
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
6889
|
-
*
|
|
6890
|
-
* @remarks
|
|
6891
|
-
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
6892
|
-
* If the `min` or `max` parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
6976
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
6977
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
6978
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
6893
6979
|
*
|
|
6894
|
-
*
|
|
6895
|
-
*
|
|
6896
|
-
*
|
|
6897
|
-
*
|
|
6898
|
-
*
|
|
6899
|
-
* new THREE.Vector3(7, 8, 9),
|
|
6900
|
-
* ];
|
|
6980
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
6981
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
6982
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
6983
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
6984
|
+
* of entities that are related through that attribute.
|
|
6901
6985
|
*
|
|
6902
|
-
*
|
|
6903
|
-
*
|
|
6904
|
-
*
|
|
6986
|
+
* @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
|
|
6987
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
6988
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
6989
|
+
* @throws An error if the model does not have properties loaded.
|
|
6905
6990
|
*/
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6991
|
+
async process(t) {
|
|
6992
|
+
if (!t.hasProperties)
|
|
6993
|
+
throw new Error("FragmentsGroup properties not found");
|
|
6994
|
+
let e = this.relationMaps[t.uuid];
|
|
6995
|
+
if (e)
|
|
6996
|
+
return e;
|
|
6997
|
+
e = /* @__PURE__ */ new Map();
|
|
6998
|
+
for (const i of this._ifcRels) {
|
|
6999
|
+
const o = await t.getAllPropertiesOfType(i);
|
|
7000
|
+
if (!o)
|
|
7001
|
+
continue;
|
|
7002
|
+
const n = this._relToAttributesMap.get(i);
|
|
7003
|
+
if (!n)
|
|
7004
|
+
continue;
|
|
7005
|
+
const { forRelated: r, forRelating: a } = n;
|
|
7006
|
+
for (const c in o) {
|
|
7007
|
+
const h = o[c];
|
|
7008
|
+
this.indexRelations(e, h, r, a);
|
|
7009
|
+
}
|
|
7010
|
+
}
|
|
7011
|
+
return this.setRelationMap(t, e), e;
|
|
6918
7012
|
}
|
|
6919
7013
|
/**
|
|
6920
|
-
*
|
|
6921
|
-
*
|
|
6922
|
-
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
6923
|
-
*
|
|
6924
|
-
* @remarks
|
|
6925
|
-
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
6926
|
-
* The returned box represents the bounding box of the calculated fragments.
|
|
7014
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
6927
7015
|
*
|
|
6928
|
-
* @
|
|
6929
|
-
*
|
|
6930
|
-
*
|
|
6931
|
-
*
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
const
|
|
6936
|
-
|
|
7016
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
7017
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
7018
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
7019
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
7020
|
+
*/
|
|
7021
|
+
async processFromWebIfc(t, e) {
|
|
7022
|
+
const i = /* @__PURE__ */ new Map();
|
|
7023
|
+
for (const o of this._ifcRels) {
|
|
7024
|
+
const n = this._relToAttributesMap.get(o);
|
|
7025
|
+
if (!n)
|
|
7026
|
+
continue;
|
|
7027
|
+
const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
|
|
7028
|
+
for (let h = 0; h < c.size(); h++) {
|
|
7029
|
+
const d = await t.properties.getItemProperties(
|
|
7030
|
+
e,
|
|
7031
|
+
c.get(h)
|
|
7032
|
+
);
|
|
7033
|
+
this.indexRelations(i, d, r, a);
|
|
7034
|
+
}
|
|
7035
|
+
}
|
|
7036
|
+
return this.onRelationsIndexed.trigger({
|
|
7037
|
+
modelID: e.toString(),
|
|
7038
|
+
relationsMap: i
|
|
7039
|
+
}), i;
|
|
6937
7040
|
}
|
|
6938
7041
|
/**
|
|
6939
|
-
*
|
|
6940
|
-
*
|
|
6941
|
-
*
|
|
6942
|
-
*
|
|
6943
|
-
* @remarks
|
|
6944
|
-
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
6945
|
-
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
6946
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
7042
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
7043
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
7044
|
+
* returning the IDs of related entities if a match is found.
|
|
6947
7045
|
*
|
|
6948
|
-
* @
|
|
6949
|
-
*
|
|
6950
|
-
*
|
|
6951
|
-
*
|
|
6952
|
-
*
|
|
6953
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
6954
|
-
* ```
|
|
7046
|
+
* @param model The `FragmentsGroup` model containing the entity.
|
|
7047
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
7048
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
7049
|
+
* @returns An array of express IDs representing the related entities, or `null` if no relations are found
|
|
7050
|
+
* or the specified relation name is not indexed.
|
|
6955
7051
|
*/
|
|
6956
|
-
|
|
6957
|
-
const
|
|
6958
|
-
|
|
7052
|
+
getEntityRelations(t, e, i) {
|
|
7053
|
+
const o = this.relationMaps[t.uuid];
|
|
7054
|
+
if (!o)
|
|
7055
|
+
return null;
|
|
7056
|
+
const n = o.get(e), r = this._inverseAttributes.indexOf(i);
|
|
7057
|
+
if (!n || r === -1)
|
|
7058
|
+
return null;
|
|
7059
|
+
const a = n.get(r);
|
|
7060
|
+
return a || null;
|
|
6959
7061
|
}
|
|
6960
7062
|
/**
|
|
6961
|
-
*
|
|
6962
|
-
*
|
|
6963
|
-
*
|
|
6964
|
-
*
|
|
6965
|
-
* @remarks
|
|
6966
|
-
* This method calculates the dimensions of the bounding box using the `getDimensions` method.
|
|
6967
|
-
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
6968
|
-
* A new THREE.Mesh is created using the box geometry, and it is added to the `_meshes` array.
|
|
6969
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
7063
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
7064
|
+
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
7065
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
7066
|
+
* The resulting object is then serialized into a JSON string.
|
|
6970
7067
|
*
|
|
6971
|
-
* @
|
|
6972
|
-
*
|
|
6973
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
6974
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
6975
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
6976
|
-
* scene.add(boundingBoxMesh);
|
|
6977
|
-
* ```
|
|
7068
|
+
* @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
7069
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
6978
7070
|
*/
|
|
6979
|
-
|
|
6980
|
-
const
|
|
6981
|
-
|
|
7071
|
+
serializeRelations(t) {
|
|
7072
|
+
const e = {};
|
|
7073
|
+
for (const [i, o] of t.entries()) {
|
|
7074
|
+
e[i] || (e[i] = {});
|
|
7075
|
+
for (const [n, r] of o.entries())
|
|
7076
|
+
e[i][n] = r;
|
|
7077
|
+
}
|
|
7078
|
+
return JSON.stringify(e);
|
|
6982
7079
|
}
|
|
6983
7080
|
/**
|
|
6984
|
-
*
|
|
6985
|
-
* This method
|
|
6986
|
-
*
|
|
6987
|
-
*
|
|
6988
|
-
*
|
|
6989
|
-
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
7081
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
7082
|
+
* This method iterates through the relations indexed for the given model,
|
|
7083
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
7084
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
7085
|
+
* The resulting object is then serialized into a JSON string.
|
|
6990
7086
|
*
|
|
6991
|
-
* @
|
|
6992
|
-
*
|
|
6993
|
-
*
|
|
6994
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
6995
|
-
* // ...
|
|
6996
|
-
* boundingBoxer.reset();
|
|
6997
|
-
* ```
|
|
7087
|
+
* @param model The `FragmentsGroup` model whose relations are to be serialized.
|
|
7088
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
7089
|
+
* If the model has no indexed relations, `null` is returned.
|
|
6998
7090
|
*/
|
|
6999
|
-
|
|
7000
|
-
|
|
7091
|
+
serializeModelRelations(t) {
|
|
7092
|
+
const e = this.relationMaps[t.uuid];
|
|
7093
|
+
return e ? this.serializeRelations(e) : null;
|
|
7001
7094
|
}
|
|
7002
7095
|
/**
|
|
7003
|
-
*
|
|
7004
|
-
*
|
|
7005
|
-
*
|
|
7006
|
-
*
|
|
7007
|
-
*
|
|
7008
|
-
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
7009
|
-
* and calls the `addMesh` method for each fragment's mesh.
|
|
7096
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
7097
|
+
* This method iterates through each model's relations indexed in `relationMaps`, organizing them
|
|
7098
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
7099
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
7100
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
7010
7101
|
*
|
|
7011
|
-
* @
|
|
7012
|
-
*
|
|
7013
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7014
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
7015
|
-
* ```
|
|
7102
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
7103
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
7016
7104
|
*/
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7105
|
+
serializeAllRelations() {
|
|
7106
|
+
const t = {};
|
|
7107
|
+
for (const e in this.relationMaps) {
|
|
7108
|
+
const i = this.relationMaps[e], o = {};
|
|
7109
|
+
for (const [n, r] of i.entries()) {
|
|
7110
|
+
o[n] || (o[n] = {});
|
|
7111
|
+
for (const [a, c] of r.entries())
|
|
7112
|
+
o[n][a] = c;
|
|
7113
|
+
}
|
|
7114
|
+
t[e] = o;
|
|
7115
|
+
}
|
|
7116
|
+
return JSON.stringify(t);
|
|
7020
7117
|
}
|
|
7021
7118
|
/**
|
|
7022
|
-
*
|
|
7023
|
-
*
|
|
7024
|
-
*
|
|
7025
|
-
*
|
|
7026
|
-
*
|
|
7027
|
-
* @remarks
|
|
7028
|
-
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
7029
|
-
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
7030
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
7119
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
7120
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
7121
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
7122
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
7123
|
+
* of express IDs of entities related through that relation type.
|
|
7031
7124
|
*
|
|
7032
|
-
* @
|
|
7033
|
-
*
|
|
7034
|
-
*
|
|
7035
|
-
*
|
|
7036
|
-
* ```
|
|
7125
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
7126
|
+
* @returns A `Map` where the key is the express ID of an entity as a number, and the value
|
|
7127
|
+
* is another `Map`. This inner map's key is the relation type ID as a number, and its value
|
|
7128
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
7037
7129
|
*/
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
for (const c of e) {
|
|
7046
|
-
const h = t.fragment.getInstancesIDs(c);
|
|
7047
|
-
if (h)
|
|
7048
|
-
for (const d of h)
|
|
7049
|
-
a.add(d);
|
|
7050
|
-
}
|
|
7051
|
-
else
|
|
7052
|
-
a.add(0);
|
|
7053
|
-
for (const c of a) {
|
|
7054
|
-
const h = i.min.clone(), d = i.max.clone();
|
|
7055
|
-
r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
|
|
7130
|
+
getRelationsMapFromJSON(t) {
|
|
7131
|
+
const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
|
|
7132
|
+
for (const o in e) {
|
|
7133
|
+
const n = e[o], r = /* @__PURE__ */ new Map();
|
|
7134
|
+
for (const a in n)
|
|
7135
|
+
r.set(Number(a), n[a]);
|
|
7136
|
+
i.set(Number(o), r);
|
|
7056
7137
|
}
|
|
7138
|
+
return i;
|
|
7057
7139
|
}
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
throw new Error("Geometry must be indexed!");
|
|
7062
|
-
const a = Array.from(t.geometry.index.array);
|
|
7063
|
-
for (let c = 0; c < a.length; c++) {
|
|
7064
|
-
if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
|
|
7065
|
-
c += 2;
|
|
7066
|
-
continue;
|
|
7067
|
-
}
|
|
7068
|
-
const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
|
|
7069
|
-
d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
|
|
7070
|
-
}
|
|
7071
|
-
return new g.Box3(n, r);
|
|
7072
|
-
}
|
|
7073
|
-
};
|
|
7074
|
-
I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
7075
|
-
let mi = At;
|
|
7076
|
-
const vn = /* @__PURE__ */ new Set([
|
|
7077
|
-
1123145078,
|
|
7078
|
-
574549367,
|
|
7079
|
-
1675464909,
|
|
7080
|
-
2059837836,
|
|
7081
|
-
3798115385,
|
|
7082
|
-
32440307,
|
|
7083
|
-
3125803723,
|
|
7084
|
-
3207858831,
|
|
7085
|
-
2740243338,
|
|
7086
|
-
2624227202,
|
|
7087
|
-
4240577450,
|
|
7088
|
-
3615266464,
|
|
7089
|
-
3724593414,
|
|
7090
|
-
220341763,
|
|
7091
|
-
477187591,
|
|
7092
|
-
1878645084,
|
|
7093
|
-
1300840506,
|
|
7094
|
-
3303107099,
|
|
7095
|
-
1607154358,
|
|
7096
|
-
1878645084,
|
|
7097
|
-
846575682,
|
|
7098
|
-
1351298697,
|
|
7099
|
-
2417041796,
|
|
7100
|
-
3049322572,
|
|
7101
|
-
3331915920,
|
|
7102
|
-
1416205885,
|
|
7103
|
-
776857604,
|
|
7104
|
-
3285139300,
|
|
7105
|
-
3958052878,
|
|
7106
|
-
2827736869,
|
|
7107
|
-
2732653382,
|
|
7108
|
-
673634403,
|
|
7109
|
-
3448662350,
|
|
7110
|
-
4142052618,
|
|
7111
|
-
2924175390,
|
|
7112
|
-
803316827,
|
|
7113
|
-
2556980723,
|
|
7114
|
-
1809719519,
|
|
7115
|
-
2205249479,
|
|
7116
|
-
807026263,
|
|
7117
|
-
3737207727,
|
|
7118
|
-
1660063152,
|
|
7119
|
-
2347385850,
|
|
7120
|
-
2705031697,
|
|
7121
|
-
3732776249,
|
|
7122
|
-
2485617015,
|
|
7123
|
-
2611217952,
|
|
7124
|
-
1704287377,
|
|
7125
|
-
2937912522,
|
|
7126
|
-
2770003689,
|
|
7127
|
-
1281925730,
|
|
7128
|
-
1484403080,
|
|
7129
|
-
3448662350,
|
|
7130
|
-
4142052618,
|
|
7131
|
-
3800577675,
|
|
7132
|
-
4006246654,
|
|
7133
|
-
3590301190,
|
|
7134
|
-
1383045692,
|
|
7135
|
-
2775532180,
|
|
7136
|
-
2047409740,
|
|
7137
|
-
370225590,
|
|
7138
|
-
3593883385,
|
|
7139
|
-
2665983363,
|
|
7140
|
-
4124623270,
|
|
7141
|
-
812098782,
|
|
7142
|
-
3649129432,
|
|
7143
|
-
987898635,
|
|
7144
|
-
1105321065,
|
|
7145
|
-
3510044353,
|
|
7146
|
-
1635779807,
|
|
7147
|
-
2603310189,
|
|
7148
|
-
3406155212,
|
|
7149
|
-
1310608509,
|
|
7150
|
-
4261334040,
|
|
7151
|
-
2736907675,
|
|
7152
|
-
3649129432,
|
|
7153
|
-
1136057603,
|
|
7154
|
-
1260505505,
|
|
7155
|
-
4182860854,
|
|
7156
|
-
2713105998,
|
|
7157
|
-
2898889636,
|
|
7158
|
-
59481748,
|
|
7159
|
-
3749851601,
|
|
7160
|
-
3486308946,
|
|
7161
|
-
3150382593,
|
|
7162
|
-
1062206242,
|
|
7163
|
-
3264961684,
|
|
7164
|
-
15328376,
|
|
7165
|
-
1485152156,
|
|
7166
|
-
370225590,
|
|
7167
|
-
1981873012,
|
|
7168
|
-
2859738748,
|
|
7169
|
-
45288368,
|
|
7170
|
-
2614616156,
|
|
7171
|
-
2732653382,
|
|
7172
|
-
775493141,
|
|
7173
|
-
2147822146,
|
|
7174
|
-
2601014836,
|
|
7175
|
-
2629017746,
|
|
7176
|
-
1186437898,
|
|
7177
|
-
2367409068,
|
|
7178
|
-
1213902940,
|
|
7179
|
-
3632507154,
|
|
7180
|
-
3900360178,
|
|
7181
|
-
476780140,
|
|
7182
|
-
1472233963,
|
|
7183
|
-
2804161546,
|
|
7184
|
-
3008276851,
|
|
7185
|
-
738692330,
|
|
7186
|
-
374418227,
|
|
7187
|
-
315944413,
|
|
7188
|
-
3905492369,
|
|
7189
|
-
3570813810,
|
|
7190
|
-
2571569899,
|
|
7191
|
-
178912537,
|
|
7192
|
-
2294589976,
|
|
7193
|
-
1437953363,
|
|
7194
|
-
2133299955,
|
|
7195
|
-
572779678,
|
|
7196
|
-
3092502836,
|
|
7197
|
-
388784114,
|
|
7198
|
-
2624227202,
|
|
7199
|
-
1425443689,
|
|
7200
|
-
3057273783,
|
|
7201
|
-
2347385850,
|
|
7202
|
-
1682466193,
|
|
7203
|
-
2519244187,
|
|
7204
|
-
2839578677,
|
|
7205
|
-
3958567839,
|
|
7206
|
-
2513912981,
|
|
7207
|
-
2830218821,
|
|
7208
|
-
427810014
|
|
7209
|
-
]), Ns = class Ns extends et {
|
|
7210
|
-
constructor(t) {
|
|
7211
|
-
super(t);
|
|
7212
|
-
/** {@link Component.enabled} */
|
|
7213
|
-
I(this, "enabled", !0);
|
|
7214
|
-
t.add(Ns.uuid, this);
|
|
7215
|
-
}
|
|
7216
|
-
/**
|
|
7217
|
-
* Exports all the properties of an IFC into an array of JS objects.
|
|
7218
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
7219
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
7220
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
7221
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
7222
|
-
* to make the location data available (e.g. absolute position of building).
|
|
7223
|
-
*/
|
|
7224
|
-
async export(t, e, i = !1, o = !0) {
|
|
7225
|
-
const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
|
|
7226
|
-
b.IFCPROJECT,
|
|
7227
|
-
b.IFCSITE,
|
|
7228
|
-
b.IFCBUILDING,
|
|
7229
|
-
b.IFCBUILDINGSTOREY,
|
|
7230
|
-
b.IFCSPACE
|
|
7231
|
-
]);
|
|
7232
|
-
for (const c of a)
|
|
7233
|
-
r.add(c);
|
|
7234
|
-
for (const c of r) {
|
|
7235
|
-
if (vn.has(c))
|
|
7236
|
-
continue;
|
|
7237
|
-
const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
|
|
7238
|
-
for (const E of d) {
|
|
7239
|
-
const u = t.GetLine(0, E, h, i);
|
|
7240
|
-
n[u.expressID] = u;
|
|
7241
|
-
}
|
|
7242
|
-
}
|
|
7243
|
-
return n;
|
|
7140
|
+
/** {@link Disposable.dispose} */
|
|
7141
|
+
dispose() {
|
|
7142
|
+
this.relationMaps = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
|
|
7244
7143
|
}
|
|
7245
7144
|
};
|
|
7246
7145
|
/**
|
|
7247
7146
|
* A unique identifier for the component.
|
|
7248
7147
|
* This UUID is used to register the component within the Components system.
|
|
7249
7148
|
*/
|
|
7250
|
-
I(
|
|
7251
|
-
let
|
|
7252
|
-
const
|
|
7149
|
+
I(Ye, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
|
|
7150
|
+
let ke = Ye;
|
|
7151
|
+
const Ns = class Ns extends et {
|
|
7253
7152
|
constructor(t) {
|
|
7254
7153
|
super(t);
|
|
7255
7154
|
/** {@link Disposable.onDisposed} */
|
|
@@ -7276,7 +7175,7 @@ const Ps = class Ps extends et {
|
|
|
7276
7175
|
/** {@link Component.enabled} */
|
|
7277
7176
|
I(this, "enabled", !0);
|
|
7278
7177
|
I(this, "_loader", new to());
|
|
7279
|
-
this.components.add(
|
|
7178
|
+
this.components.add(Ns.uuid, this);
|
|
7280
7179
|
}
|
|
7281
7180
|
/**
|
|
7282
7181
|
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
@@ -7407,327 +7306,460 @@ const Ps = class Ps extends et {
|
|
|
7407
7306
|
* A unique identifier for the component.
|
|
7408
7307
|
* This UUID is used to register the component within the Components system.
|
|
7409
7308
|
*/
|
|
7410
|
-
I(
|
|
7411
|
-
let
|
|
7412
|
-
const
|
|
7413
|
-
[
|
|
7414
|
-
b.IFCRELAGGREGATES,
|
|
7415
|
-
{
|
|
7416
|
-
forRelating: "IsDecomposedBy",
|
|
7417
|
-
forRelated: "Decomposes"
|
|
7418
|
-
}
|
|
7419
|
-
],
|
|
7420
|
-
[
|
|
7421
|
-
b.IFCRELASSOCIATESMATERIAL,
|
|
7422
|
-
{
|
|
7423
|
-
forRelating: "AssociatedTo",
|
|
7424
|
-
forRelated: "HasAssociations"
|
|
7425
|
-
}
|
|
7426
|
-
],
|
|
7427
|
-
[
|
|
7428
|
-
b.IFCRELASSOCIATESCLASSIFICATION,
|
|
7429
|
-
{
|
|
7430
|
-
forRelating: "ClassificationForObjects",
|
|
7431
|
-
forRelated: "HasAssociations"
|
|
7432
|
-
}
|
|
7433
|
-
],
|
|
7434
|
-
[
|
|
7435
|
-
b.IFCRELASSIGNSTOGROUP,
|
|
7436
|
-
{
|
|
7437
|
-
forRelating: "IsGroupedBy",
|
|
7438
|
-
forRelated: "HasAssignments"
|
|
7439
|
-
}
|
|
7440
|
-
],
|
|
7441
|
-
[
|
|
7442
|
-
b.IFCRELDEFINESBYPROPERTIES,
|
|
7443
|
-
{
|
|
7444
|
-
forRelated: "IsDefinedBy",
|
|
7445
|
-
forRelating: "DefinesOcurrence"
|
|
7446
|
-
}
|
|
7447
|
-
],
|
|
7448
|
-
[
|
|
7449
|
-
b.IFCRELDEFINESBYTYPE,
|
|
7450
|
-
{
|
|
7451
|
-
forRelated: "IsTypedBy",
|
|
7452
|
-
forRelating: "Types"
|
|
7453
|
-
}
|
|
7454
|
-
],
|
|
7455
|
-
[
|
|
7456
|
-
b.IFCRELDEFINESBYTEMPLATE,
|
|
7457
|
-
{
|
|
7458
|
-
forRelated: "IsDefinedBy",
|
|
7459
|
-
forRelating: "Defines"
|
|
7460
|
-
}
|
|
7461
|
-
],
|
|
7462
|
-
[
|
|
7463
|
-
b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
7464
|
-
{
|
|
7465
|
-
forRelated: "ContainedInStructure",
|
|
7466
|
-
forRelating: "ContainsElements"
|
|
7467
|
-
}
|
|
7468
|
-
]
|
|
7469
|
-
]), Ye = class Ye extends et {
|
|
7309
|
+
I(Ns, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
|
|
7310
|
+
let ht = Ns;
|
|
7311
|
+
const At = class At extends et {
|
|
7470
7312
|
constructor(t) {
|
|
7471
7313
|
super(t);
|
|
7472
|
-
/** {@link Disposable.onDisposed} */
|
|
7473
|
-
I(this, "onDisposed", new D());
|
|
7474
|
-
/**
|
|
7475
|
-
* Event triggered when relations for a model have been indexed.
|
|
7476
|
-
* This event provides the model's UUID and the relations map generated for that model.
|
|
7477
|
-
*
|
|
7478
|
-
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
7479
|
-
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
7480
|
-
* The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
7481
|
-
*/
|
|
7482
|
-
I(this, "onRelationsIndexed", new D());
|
|
7483
|
-
/**
|
|
7484
|
-
* Holds the relationship mappings for each model processed by the indexer.
|
|
7485
|
-
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
7486
|
-
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
7487
|
-
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
7488
|
-
* that are related through that relation type. This structure allows for efficient querying
|
|
7489
|
-
* of entity relationships within a model.
|
|
7490
|
-
*/
|
|
7491
|
-
I(this, "relationMaps", {});
|
|
7492
7314
|
/** {@link Component.enabled} */
|
|
7493
7315
|
I(this, "enabled", !0);
|
|
7494
|
-
|
|
7495
|
-
I(this, "
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
"ClassificationForObjects",
|
|
7501
|
-
"IsGroupedBy",
|
|
7502
|
-
"HasAssignments",
|
|
7503
|
-
"IsDefinedBy",
|
|
7504
|
-
"DefinesOcurrence",
|
|
7505
|
-
"IsTypedBy",
|
|
7506
|
-
"Types",
|
|
7507
|
-
"Defines",
|
|
7508
|
-
"ContainedInStructure",
|
|
7509
|
-
"ContainsElements"
|
|
7510
|
-
]);
|
|
7511
|
-
I(this, "_ifcRels", [
|
|
7512
|
-
b.IFCRELAGGREGATES,
|
|
7513
|
-
b.IFCRELASSOCIATESMATERIAL,
|
|
7514
|
-
b.IFCRELASSOCIATESCLASSIFICATION,
|
|
7515
|
-
b.IFCRELASSIGNSTOGROUP,
|
|
7516
|
-
b.IFCRELDEFINESBYPROPERTIES,
|
|
7517
|
-
b.IFCRELDEFINESBYTYPE,
|
|
7518
|
-
b.IFCRELDEFINESBYTEMPLATE,
|
|
7519
|
-
b.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
7520
|
-
]);
|
|
7521
|
-
I(this, "onFragmentsDisposed", (t) => {
|
|
7522
|
-
delete this.relationMaps[t.groupID];
|
|
7523
|
-
});
|
|
7524
|
-
this.components.add(Ye.uuid, this), t.get(Et).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
7316
|
+
/** {@link Disposable.onDisposed} */
|
|
7317
|
+
I(this, "onDisposed", new D());
|
|
7318
|
+
I(this, "_absoluteMin");
|
|
7319
|
+
I(this, "_absoluteMax");
|
|
7320
|
+
I(this, "_meshes", []);
|
|
7321
|
+
this.components.add(At.uuid, this), this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
7525
7322
|
}
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
h.set(d, c), t.set(a, h);
|
|
7536
|
-
for (const E of c) {
|
|
7537
|
-
const u = t.get(E) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(i), R = u.get(f) ?? [];
|
|
7538
|
-
R.push(a), u.set(f, R), t.set(E, u);
|
|
7539
|
-
}
|
|
7323
|
+
/**
|
|
7324
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
7325
|
+
*
|
|
7326
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
7327
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
7328
|
+
*/
|
|
7329
|
+
static getDimensions(t) {
|
|
7330
|
+
const { min: e, max: i } = t, o = Math.abs(i.x - e.x), n = Math.abs(i.y - e.y), r = Math.abs(i.z - e.z), a = new g.Vector3();
|
|
7331
|
+
return a.subVectors(i, e).divideScalar(2).add(e), { width: o, height: n, depth: r, center: a };
|
|
7540
7332
|
}
|
|
7541
7333
|
/**
|
|
7542
|
-
*
|
|
7334
|
+
* A static method to create a new bounding box boundary.
|
|
7543
7335
|
*
|
|
7544
|
-
* @param
|
|
7545
|
-
* @
|
|
7336
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
7337
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
7546
7338
|
*
|
|
7547
|
-
* @
|
|
7339
|
+
* @remarks
|
|
7340
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
7341
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
7342
|
+
* depending on the value of the `positive` parameter.
|
|
7343
|
+
*
|
|
7344
|
+
* @example
|
|
7345
|
+
* ```typescript
|
|
7346
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
7347
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
7348
|
+
*
|
|
7349
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
7350
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
7351
|
+
* ```
|
|
7548
7352
|
*/
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7353
|
+
static newBound(t) {
|
|
7354
|
+
const e = t ? 1 : -1;
|
|
7355
|
+
return new g.Vector3(
|
|
7356
|
+
e * Number.MAX_VALUE,
|
|
7357
|
+
e * Number.MAX_VALUE,
|
|
7358
|
+
e * Number.MAX_VALUE
|
|
7359
|
+
);
|
|
7554
7360
|
}
|
|
7555
7361
|
/**
|
|
7556
|
-
*
|
|
7557
|
-
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
7558
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
7362
|
+
* A static method to calculate the bounding box of a set of points.
|
|
7559
7363
|
*
|
|
7560
|
-
*
|
|
7561
|
-
*
|
|
7562
|
-
*
|
|
7563
|
-
*
|
|
7564
|
-
* of entities that are related through that attribute.
|
|
7364
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
7365
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
7366
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
7367
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
7565
7368
|
*
|
|
7566
|
-
* @
|
|
7567
|
-
*
|
|
7568
|
-
*
|
|
7569
|
-
*
|
|
7369
|
+
* @remarks
|
|
7370
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
7371
|
+
* If the `min` or `max` parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
7372
|
+
*
|
|
7373
|
+
* @example
|
|
7374
|
+
* ```typescript
|
|
7375
|
+
* const points = [
|
|
7376
|
+
* new THREE.Vector3(1, 2, 3),
|
|
7377
|
+
* new THREE.Vector3(4, 5, 6),
|
|
7378
|
+
* new THREE.Vector3(7, 8, 9),
|
|
7379
|
+
* ];
|
|
7380
|
+
*
|
|
7381
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
7382
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
7383
|
+
* ```
|
|
7570
7384
|
*/
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
if (!n)
|
|
7584
|
-
continue;
|
|
7585
|
-
const { forRelated: r, forRelating: a } = n;
|
|
7586
|
-
for (const c in o) {
|
|
7587
|
-
const h = o[c];
|
|
7588
|
-
this.indexRelations(e, h, r, a);
|
|
7589
|
-
}
|
|
7590
|
-
}
|
|
7591
|
-
return this.setRelationMap(t, e), e;
|
|
7385
|
+
static getBounds(t, e, i) {
|
|
7386
|
+
const o = i || this.newBound(!1), n = e || this.newBound(!0);
|
|
7387
|
+
for (const r of t)
|
|
7388
|
+
r.x < n.x && (n.x = r.x), r.y < n.y && (n.y = r.y), r.z < n.z && (n.z = r.z), r.x > o.x && (o.x = r.x), r.y > o.y && (o.y = r.y), r.z > o.z && (o.z = r.z);
|
|
7389
|
+
return new g.Box3(e, i);
|
|
7390
|
+
}
|
|
7391
|
+
/** {@link Disposable.dispose} */
|
|
7392
|
+
dispose() {
|
|
7393
|
+
const t = this.components.get(zt);
|
|
7394
|
+
for (const e of this._meshes)
|
|
7395
|
+
t.destroy(e);
|
|
7396
|
+
this._meshes = [], this.onDisposed.trigger(At.uuid), this.onDisposed.reset();
|
|
7592
7397
|
}
|
|
7593
7398
|
/**
|
|
7594
|
-
*
|
|
7399
|
+
* Returns the bounding box of the calculated fragments.
|
|
7595
7400
|
*
|
|
7596
|
-
* @
|
|
7597
|
-
*
|
|
7598
|
-
* @
|
|
7599
|
-
*
|
|
7401
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
7402
|
+
*
|
|
7403
|
+
* @remarks
|
|
7404
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
7405
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
7406
|
+
*
|
|
7407
|
+
* @example
|
|
7408
|
+
* ```typescript
|
|
7409
|
+
* const boundingBox = boundingBoxer.get();
|
|
7410
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
7411
|
+
* ```
|
|
7600
7412
|
*/
|
|
7601
|
-
|
|
7602
|
-
const
|
|
7603
|
-
|
|
7604
|
-
const n = this._relToAttributesMap.get(o);
|
|
7605
|
-
if (!n)
|
|
7606
|
-
continue;
|
|
7607
|
-
const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
|
|
7608
|
-
for (let h = 0; h < c.size(); h++) {
|
|
7609
|
-
const d = await t.properties.getItemProperties(
|
|
7610
|
-
e,
|
|
7611
|
-
c.get(h)
|
|
7612
|
-
);
|
|
7613
|
-
this.indexRelations(i, d, r, a);
|
|
7614
|
-
}
|
|
7615
|
-
}
|
|
7616
|
-
return this.onRelationsIndexed.trigger({
|
|
7617
|
-
modelID: e.toString(),
|
|
7618
|
-
relationsMap: i
|
|
7619
|
-
}), i;
|
|
7413
|
+
get() {
|
|
7414
|
+
const t = this._absoluteMin.clone(), e = this._absoluteMax.clone();
|
|
7415
|
+
return new g.Box3(t, e);
|
|
7620
7416
|
}
|
|
7621
7417
|
/**
|
|
7622
|
-
*
|
|
7623
|
-
* This method searches the indexed relation maps for the specified model and entity,
|
|
7624
|
-
* returning the IDs of related entities if a match is found.
|
|
7418
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
7625
7419
|
*
|
|
7626
|
-
* @
|
|
7627
|
-
*
|
|
7628
|
-
* @
|
|
7629
|
-
*
|
|
7630
|
-
*
|
|
7420
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
7421
|
+
*
|
|
7422
|
+
* @remarks
|
|
7423
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
7424
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
7425
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
7426
|
+
*
|
|
7427
|
+
* @example
|
|
7428
|
+
* ```typescript
|
|
7429
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7430
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
7431
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
7432
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
7433
|
+
* ```
|
|
7631
7434
|
*/
|
|
7632
|
-
|
|
7633
|
-
const
|
|
7634
|
-
|
|
7635
|
-
return null;
|
|
7636
|
-
const n = o.get(e), r = this._inverseAttributes.indexOf(i);
|
|
7637
|
-
if (!n || r === -1)
|
|
7638
|
-
return null;
|
|
7639
|
-
const a = n.get(r);
|
|
7640
|
-
return a || null;
|
|
7435
|
+
getSphere() {
|
|
7436
|
+
const t = this._absoluteMin.clone(), e = this._absoluteMax.clone(), i = Math.abs((e.x - t.x) / 2), o = Math.abs((e.y - t.y) / 2), n = Math.abs((e.z - t.z) / 2), r = new g.Vector3(t.x + i, t.y + o, t.z + n), a = r.distanceTo(t);
|
|
7437
|
+
return new g.Sphere(r, a);
|
|
7641
7438
|
}
|
|
7642
7439
|
/**
|
|
7643
|
-
*
|
|
7644
|
-
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
7645
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
7646
|
-
* The resulting object is then serialized into a JSON string.
|
|
7440
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
7647
7441
|
*
|
|
7648
|
-
* @
|
|
7649
|
-
*
|
|
7442
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
7443
|
+
*
|
|
7444
|
+
* @remarks
|
|
7445
|
+
* This method calculates the dimensions of the bounding box using the `getDimensions` method.
|
|
7446
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
7447
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the `_meshes` array.
|
|
7448
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
7449
|
+
*
|
|
7450
|
+
* @example
|
|
7451
|
+
* ```typescript
|
|
7452
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7453
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
7454
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
7455
|
+
* scene.add(boundingBoxMesh);
|
|
7456
|
+
* ```
|
|
7650
7457
|
*/
|
|
7651
|
-
|
|
7652
|
-
const e = {};
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7458
|
+
getMesh() {
|
|
7459
|
+
const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n), c = new g.Mesh(a);
|
|
7460
|
+
return this._meshes.push(c), c.position.copy(r), c;
|
|
7461
|
+
}
|
|
7462
|
+
/**
|
|
7463
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
7464
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
7465
|
+
*
|
|
7466
|
+
* @remarks
|
|
7467
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
7468
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
7469
|
+
*
|
|
7470
|
+
* @example
|
|
7471
|
+
* ```typescript
|
|
7472
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7473
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
7474
|
+
* // ...
|
|
7475
|
+
* boundingBoxer.reset();
|
|
7476
|
+
* ```
|
|
7477
|
+
*/
|
|
7478
|
+
reset() {
|
|
7479
|
+
this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
7480
|
+
}
|
|
7481
|
+
/**
|
|
7482
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
7483
|
+
*
|
|
7484
|
+
* @param group - The FragmentsGroup to add.
|
|
7485
|
+
*
|
|
7486
|
+
* @remarks
|
|
7487
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
7488
|
+
* and calls the `addMesh` method for each fragment's mesh.
|
|
7489
|
+
*
|
|
7490
|
+
* @example
|
|
7491
|
+
* ```typescript
|
|
7492
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7493
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
7494
|
+
* ```
|
|
7495
|
+
*/
|
|
7496
|
+
add(t) {
|
|
7497
|
+
for (const e of t.items)
|
|
7498
|
+
this.addMesh(e.mesh);
|
|
7499
|
+
}
|
|
7500
|
+
/**
|
|
7501
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
7502
|
+
*
|
|
7503
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
7504
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
7505
|
+
*
|
|
7506
|
+
* @remarks
|
|
7507
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
7508
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
7509
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
7510
|
+
*
|
|
7511
|
+
* @example
|
|
7512
|
+
* ```typescript
|
|
7513
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7514
|
+
* boundingBoxer.addMesh(mesh);
|
|
7515
|
+
* ```
|
|
7516
|
+
*/
|
|
7517
|
+
addMesh(t, e) {
|
|
7518
|
+
if (!t.geometry.index)
|
|
7519
|
+
return;
|
|
7520
|
+
const i = At.getFragmentBounds(t);
|
|
7521
|
+
t.updateMatrixWorld();
|
|
7522
|
+
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
7523
|
+
if (e && t instanceof Vt.FragmentMesh)
|
|
7524
|
+
for (const c of e) {
|
|
7525
|
+
const h = t.fragment.getInstancesIDs(c);
|
|
7526
|
+
if (h)
|
|
7527
|
+
for (const d of h)
|
|
7528
|
+
a.add(d);
|
|
7529
|
+
}
|
|
7530
|
+
else
|
|
7531
|
+
a.add(0);
|
|
7532
|
+
for (const c of a) {
|
|
7533
|
+
const h = i.min.clone(), d = i.max.clone();
|
|
7534
|
+
r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
|
|
7657
7535
|
}
|
|
7658
|
-
return JSON.stringify(e);
|
|
7659
7536
|
}
|
|
7660
7537
|
/**
|
|
7661
|
-
*
|
|
7662
|
-
* This method iterates through the relations indexed for the given model,
|
|
7663
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
7664
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
7665
|
-
* The resulting object is then serialized into a JSON string.
|
|
7538
|
+
* Uses a FragmentIdMap to add its meshes to the bb calculation.
|
|
7666
7539
|
*
|
|
7667
|
-
*
|
|
7668
|
-
*
|
|
7669
|
-
* If the model has no indexed relations, `null` is returned.
|
|
7670
|
-
*/
|
|
7671
|
-
serializeModelRelations(t) {
|
|
7672
|
-
const e = this.relationMaps[t.uuid];
|
|
7673
|
-
return e ? this.serializeRelations(e) : null;
|
|
7674
|
-
}
|
|
7675
|
-
/**
|
|
7676
|
-
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
7677
|
-
* This method iterates through each model's relations indexed in `relationMaps`, organizing them
|
|
7678
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
7679
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
7680
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
7540
|
+
* This method iterates through the provided `fragmentIdMap`, retrieves the corresponding fragment from the `FragmentsManager`,
|
|
7541
|
+
* and then calls the `addMesh` method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
7681
7542
|
*
|
|
7682
|
-
* @
|
|
7683
|
-
*
|
|
7543
|
+
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
7544
|
+
*
|
|
7545
|
+
* @remarks
|
|
7546
|
+
* This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
|
|
7547
|
+
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
7548
|
+
*
|
|
7549
|
+
* @example
|
|
7550
|
+
* ```typescript
|
|
7551
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
7552
|
+
* const fragmentIdMap: FRAGS.FragmentIdMap = {
|
|
7553
|
+
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
7554
|
+
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
7555
|
+
* };
|
|
7556
|
+
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
7557
|
+
* ```
|
|
7684
7558
|
*/
|
|
7685
|
-
|
|
7686
|
-
const
|
|
7687
|
-
for (const
|
|
7688
|
-
const
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7559
|
+
addFragmentIdMap(t) {
|
|
7560
|
+
const e = this.components.get(ht);
|
|
7561
|
+
for (const i in t) {
|
|
7562
|
+
const o = e.list.get(i);
|
|
7563
|
+
if (!o)
|
|
7564
|
+
continue;
|
|
7565
|
+
const n = t[i];
|
|
7566
|
+
this.addMesh(o.mesh, n);
|
|
7567
|
+
}
|
|
7568
|
+
}
|
|
7569
|
+
static getFragmentBounds(t) {
|
|
7570
|
+
const e = t.geometry.attributes.position, i = Number.MAX_VALUE, o = -i, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
|
|
7571
|
+
if (!t.geometry.index)
|
|
7572
|
+
throw new Error("Geometry must be indexed!");
|
|
7573
|
+
const a = Array.from(t.geometry.index.array);
|
|
7574
|
+
for (let c = 0; c < a.length; c++) {
|
|
7575
|
+
if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
|
|
7576
|
+
c += 2;
|
|
7577
|
+
continue;
|
|
7693
7578
|
}
|
|
7694
|
-
|
|
7579
|
+
const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
|
|
7580
|
+
d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
|
|
7695
7581
|
}
|
|
7696
|
-
return
|
|
7582
|
+
return new g.Box3(n, r);
|
|
7583
|
+
}
|
|
7584
|
+
};
|
|
7585
|
+
I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
7586
|
+
let Fn = At;
|
|
7587
|
+
const vn = /* @__PURE__ */ new Set([
|
|
7588
|
+
1123145078,
|
|
7589
|
+
574549367,
|
|
7590
|
+
1675464909,
|
|
7591
|
+
2059837836,
|
|
7592
|
+
3798115385,
|
|
7593
|
+
32440307,
|
|
7594
|
+
3125803723,
|
|
7595
|
+
3207858831,
|
|
7596
|
+
2740243338,
|
|
7597
|
+
2624227202,
|
|
7598
|
+
4240577450,
|
|
7599
|
+
3615266464,
|
|
7600
|
+
3724593414,
|
|
7601
|
+
220341763,
|
|
7602
|
+
477187591,
|
|
7603
|
+
1878645084,
|
|
7604
|
+
1300840506,
|
|
7605
|
+
3303107099,
|
|
7606
|
+
1607154358,
|
|
7607
|
+
1878645084,
|
|
7608
|
+
846575682,
|
|
7609
|
+
1351298697,
|
|
7610
|
+
2417041796,
|
|
7611
|
+
3049322572,
|
|
7612
|
+
3331915920,
|
|
7613
|
+
1416205885,
|
|
7614
|
+
776857604,
|
|
7615
|
+
3285139300,
|
|
7616
|
+
3958052878,
|
|
7617
|
+
2827736869,
|
|
7618
|
+
2732653382,
|
|
7619
|
+
673634403,
|
|
7620
|
+
3448662350,
|
|
7621
|
+
4142052618,
|
|
7622
|
+
2924175390,
|
|
7623
|
+
803316827,
|
|
7624
|
+
2556980723,
|
|
7625
|
+
1809719519,
|
|
7626
|
+
2205249479,
|
|
7627
|
+
807026263,
|
|
7628
|
+
3737207727,
|
|
7629
|
+
1660063152,
|
|
7630
|
+
2347385850,
|
|
7631
|
+
2705031697,
|
|
7632
|
+
3732776249,
|
|
7633
|
+
2485617015,
|
|
7634
|
+
2611217952,
|
|
7635
|
+
1704287377,
|
|
7636
|
+
2937912522,
|
|
7637
|
+
2770003689,
|
|
7638
|
+
1281925730,
|
|
7639
|
+
1484403080,
|
|
7640
|
+
3448662350,
|
|
7641
|
+
4142052618,
|
|
7642
|
+
3800577675,
|
|
7643
|
+
4006246654,
|
|
7644
|
+
3590301190,
|
|
7645
|
+
1383045692,
|
|
7646
|
+
2775532180,
|
|
7647
|
+
2047409740,
|
|
7648
|
+
370225590,
|
|
7649
|
+
3593883385,
|
|
7650
|
+
2665983363,
|
|
7651
|
+
4124623270,
|
|
7652
|
+
812098782,
|
|
7653
|
+
3649129432,
|
|
7654
|
+
987898635,
|
|
7655
|
+
1105321065,
|
|
7656
|
+
3510044353,
|
|
7657
|
+
1635779807,
|
|
7658
|
+
2603310189,
|
|
7659
|
+
3406155212,
|
|
7660
|
+
1310608509,
|
|
7661
|
+
4261334040,
|
|
7662
|
+
2736907675,
|
|
7663
|
+
3649129432,
|
|
7664
|
+
1136057603,
|
|
7665
|
+
1260505505,
|
|
7666
|
+
4182860854,
|
|
7667
|
+
2713105998,
|
|
7668
|
+
2898889636,
|
|
7669
|
+
59481748,
|
|
7670
|
+
3749851601,
|
|
7671
|
+
3486308946,
|
|
7672
|
+
3150382593,
|
|
7673
|
+
1062206242,
|
|
7674
|
+
3264961684,
|
|
7675
|
+
15328376,
|
|
7676
|
+
1485152156,
|
|
7677
|
+
370225590,
|
|
7678
|
+
1981873012,
|
|
7679
|
+
2859738748,
|
|
7680
|
+
45288368,
|
|
7681
|
+
2614616156,
|
|
7682
|
+
2732653382,
|
|
7683
|
+
775493141,
|
|
7684
|
+
2147822146,
|
|
7685
|
+
2601014836,
|
|
7686
|
+
2629017746,
|
|
7687
|
+
1186437898,
|
|
7688
|
+
2367409068,
|
|
7689
|
+
1213902940,
|
|
7690
|
+
3632507154,
|
|
7691
|
+
3900360178,
|
|
7692
|
+
476780140,
|
|
7693
|
+
1472233963,
|
|
7694
|
+
2804161546,
|
|
7695
|
+
3008276851,
|
|
7696
|
+
738692330,
|
|
7697
|
+
374418227,
|
|
7698
|
+
315944413,
|
|
7699
|
+
3905492369,
|
|
7700
|
+
3570813810,
|
|
7701
|
+
2571569899,
|
|
7702
|
+
178912537,
|
|
7703
|
+
2294589976,
|
|
7704
|
+
1437953363,
|
|
7705
|
+
2133299955,
|
|
7706
|
+
572779678,
|
|
7707
|
+
3092502836,
|
|
7708
|
+
388784114,
|
|
7709
|
+
2624227202,
|
|
7710
|
+
1425443689,
|
|
7711
|
+
3057273783,
|
|
7712
|
+
2347385850,
|
|
7713
|
+
1682466193,
|
|
7714
|
+
2519244187,
|
|
7715
|
+
2839578677,
|
|
7716
|
+
3958567839,
|
|
7717
|
+
2513912981,
|
|
7718
|
+
2830218821,
|
|
7719
|
+
427810014
|
|
7720
|
+
]), Ps = class Ps extends et {
|
|
7721
|
+
constructor(t) {
|
|
7722
|
+
super(t);
|
|
7723
|
+
/** {@link Component.enabled} */
|
|
7724
|
+
I(this, "enabled", !0);
|
|
7725
|
+
t.add(Ps.uuid, this);
|
|
7697
7726
|
}
|
|
7698
7727
|
/**
|
|
7699
|
-
*
|
|
7700
|
-
*
|
|
7701
|
-
*
|
|
7702
|
-
*
|
|
7703
|
-
*
|
|
7704
|
-
*
|
|
7705
|
-
* @param json The JSON string to be parsed into the relations map.
|
|
7706
|
-
* @returns A `Map` where the key is the express ID of an entity as a number, and the value
|
|
7707
|
-
* is another `Map`. This inner map's key is the relation type ID as a number, and its value
|
|
7708
|
-
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
7728
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
7729
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
7730
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
7731
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
7732
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
7733
|
+
* to make the location data available (e.g. absolute position of building).
|
|
7709
7734
|
*/
|
|
7710
|
-
|
|
7711
|
-
const
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7735
|
+
async export(t, e, i = !1, o = !0) {
|
|
7736
|
+
const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
|
|
7737
|
+
b.IFCPROJECT,
|
|
7738
|
+
b.IFCSITE,
|
|
7739
|
+
b.IFCBUILDING,
|
|
7740
|
+
b.IFCBUILDINGSTOREY,
|
|
7741
|
+
b.IFCSPACE
|
|
7742
|
+
]);
|
|
7743
|
+
for (const c of a)
|
|
7744
|
+
r.add(c);
|
|
7745
|
+
for (const c of r) {
|
|
7746
|
+
if (vn.has(c))
|
|
7747
|
+
continue;
|
|
7748
|
+
const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
|
|
7749
|
+
for (const E of d) {
|
|
7750
|
+
const u = t.GetLine(0, E, h, i);
|
|
7751
|
+
n[u.expressID] = u;
|
|
7752
|
+
}
|
|
7717
7753
|
}
|
|
7718
|
-
return
|
|
7719
|
-
}
|
|
7720
|
-
/** {@link Disposable.dispose} */
|
|
7721
|
-
dispose() {
|
|
7722
|
-
this.relationMaps = {}, this.components.get(Et).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
|
|
7754
|
+
return n;
|
|
7723
7755
|
}
|
|
7724
7756
|
};
|
|
7725
7757
|
/**
|
|
7726
7758
|
* A unique identifier for the component.
|
|
7727
7759
|
* This UUID is used to register the component within the Components system.
|
|
7728
7760
|
*/
|
|
7729
|
-
I(
|
|
7730
|
-
let
|
|
7761
|
+
I(Ps, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
|
|
7762
|
+
let mi = Ps;
|
|
7731
7763
|
const Zr = {
|
|
7732
7764
|
103090709: "IFCPROJECT",
|
|
7733
7765
|
4097777520: "IFCSITE",
|
|
@@ -9283,7 +9315,7 @@ class Yn {
|
|
|
9283
9315
|
this.itemsByFloor = {};
|
|
9284
9316
|
}
|
|
9285
9317
|
}
|
|
9286
|
-
class
|
|
9318
|
+
class Li {
|
|
9287
9319
|
constructor() {
|
|
9288
9320
|
/** Whether to extract the IFC properties into a JSON. */
|
|
9289
9321
|
I(this, "includeProperties", !0);
|
|
@@ -9430,7 +9462,7 @@ const Ve = class Ve extends et {
|
|
|
9430
9462
|
* The settings for the IfcLoader.
|
|
9431
9463
|
* It includes options for excluding categories, setting WASM paths, and more.
|
|
9432
9464
|
*/
|
|
9433
|
-
I(this, "settings", new
|
|
9465
|
+
I(this, "settings", new Li());
|
|
9434
9466
|
/**
|
|
9435
9467
|
* The instance of the Web-IFC library used for handling IFC data.
|
|
9436
9468
|
*/
|
|
@@ -9491,9 +9523,9 @@ const Ve = class Ve extends et {
|
|
|
9491
9523
|
async load(t, e = !0) {
|
|
9492
9524
|
const i = performance.now();
|
|
9493
9525
|
this.onIfcStartedLoading.trigger(), await this.readIfcFile(t);
|
|
9494
|
-
const o = await this.getAllGeometries(), r = await this.components.get(
|
|
9526
|
+
const o = await this.getAllGeometries(), r = await this.components.get(mi).export(this.webIfc, 0);
|
|
9495
9527
|
o.setLocalProperties(r), this.cleanUp();
|
|
9496
|
-
const a = this.components.get(
|
|
9528
|
+
const a = this.components.get(ht);
|
|
9497
9529
|
a.groups.set(o.uuid, o);
|
|
9498
9530
|
for (const c of o.items)
|
|
9499
9531
|
a.list.set(c.id, c), c.mesh.uuid = c.id, c.group = o;
|
|
@@ -9658,7 +9690,7 @@ const Ve = class Ve extends et {
|
|
|
9658
9690
|
* This UUID is used to register the component within the Components system.
|
|
9659
9691
|
*/
|
|
9660
9692
|
I(Ve, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
|
|
9661
|
-
let
|
|
9693
|
+
let Ri = Ve;
|
|
9662
9694
|
const Bt = class Bt extends et {
|
|
9663
9695
|
constructor(t) {
|
|
9664
9696
|
super(t);
|
|
@@ -9919,7 +9951,7 @@ const Bt = class Bt extends et {
|
|
|
9919
9951
|
* @throws Will throw an error if any issues occur during the saving process.
|
|
9920
9952
|
*/
|
|
9921
9953
|
async saveToIfc(t, e) {
|
|
9922
|
-
const i = this.components.get(
|
|
9954
|
+
const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
|
|
9923
9955
|
for (const c of r) {
|
|
9924
9956
|
const h = await t.getProperties(c);
|
|
9925
9957
|
if (h)
|
|
@@ -10040,11 +10072,11 @@ const Ls = class Ls extends et {
|
|
|
10040
10072
|
}
|
|
10041
10073
|
}
|
|
10042
10074
|
});
|
|
10043
|
-
t.add(Ls.uuid, this), t.get(
|
|
10075
|
+
t.add(Ls.uuid, this), t.get(ht).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
10044
10076
|
}
|
|
10045
10077
|
/** {@link Disposable.dispose} */
|
|
10046
10078
|
dispose() {
|
|
10047
|
-
this.list = {}, this.components.get(
|
|
10079
|
+
this.list = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(), this.onDisposed.reset();
|
|
10048
10080
|
}
|
|
10049
10081
|
/**
|
|
10050
10082
|
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
@@ -10075,7 +10107,7 @@ const Ls = class Ls extends et {
|
|
|
10075
10107
|
* @throws Will throw an error if the fragments map is malformed.
|
|
10076
10108
|
*/
|
|
10077
10109
|
find(t) {
|
|
10078
|
-
const e = this.components.get(
|
|
10110
|
+
const e = this.components.get(ht);
|
|
10079
10111
|
if (!t) {
|
|
10080
10112
|
const r = {};
|
|
10081
10113
|
for (const [a, c] of e.list)
|
|
@@ -10300,7 +10332,7 @@ const Ls = class Ls extends et {
|
|
|
10300
10332
|
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
10301
10333
|
*/
|
|
10302
10334
|
setColor(t, e, i = !1) {
|
|
10303
|
-
const o = this.components.get(
|
|
10335
|
+
const o = this.components.get(ht);
|
|
10304
10336
|
for (const n in t) {
|
|
10305
10337
|
const r = o.list.get(n);
|
|
10306
10338
|
if (!r)
|
|
@@ -10321,7 +10353,7 @@ const Ls = class Ls extends et {
|
|
|
10321
10353
|
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
10322
10354
|
*/
|
|
10323
10355
|
resetColor(t) {
|
|
10324
|
-
const e = this.components.get(
|
|
10356
|
+
const e = this.components.get(ht);
|
|
10325
10357
|
for (const i in t) {
|
|
10326
10358
|
const o = e.list.get(i);
|
|
10327
10359
|
if (!o)
|
|
@@ -10348,7 +10380,7 @@ const Ls = class Ls extends et {
|
|
|
10348
10380
|
* This UUID is used to register the component within the Components system.
|
|
10349
10381
|
*/
|
|
10350
10382
|
I(Ls, "uuid", "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");
|
|
10351
|
-
let
|
|
10383
|
+
let Ai = Ls;
|
|
10352
10384
|
const ys = class ys extends et {
|
|
10353
10385
|
constructor(t) {
|
|
10354
10386
|
super(t);
|
|
@@ -10396,7 +10428,7 @@ const ys = class ys extends et {
|
|
|
10396
10428
|
set(t) {
|
|
10397
10429
|
if (!this.enabled)
|
|
10398
10430
|
return;
|
|
10399
|
-
const e = this.components.get(
|
|
10431
|
+
const e = this.components.get(Ai), i = this.components.get(ht), o = t ? 1 : -1;
|
|
10400
10432
|
let n = 0;
|
|
10401
10433
|
const r = e.list[this.groupName], a = new g.Matrix4();
|
|
10402
10434
|
for (const c in r) {
|
|
@@ -10438,7 +10470,7 @@ const Ms = class Ms extends et {
|
|
|
10438
10470
|
* @returns {void}
|
|
10439
10471
|
*/
|
|
10440
10472
|
set(t, e) {
|
|
10441
|
-
const i = this.components.get(
|
|
10473
|
+
const i = this.components.get(ht);
|
|
10442
10474
|
if (!e) {
|
|
10443
10475
|
for (const [o, n] of i.list)
|
|
10444
10476
|
n && (n.setVisibility(t), this.updateCulledVisibility(n));
|
|
@@ -10475,7 +10507,7 @@ const Ms = class Ms extends et {
|
|
|
10475
10507
|
*/
|
|
10476
10508
|
I(Ms, "uuid", "dd9ccf2d-8a21-4821-b7f6-2949add16a29");
|
|
10477
10509
|
let _n = Ms;
|
|
10478
|
-
class jr extends
|
|
10510
|
+
class jr extends Li {
|
|
10479
10511
|
constructor() {
|
|
10480
10512
|
super(...arguments);
|
|
10481
10513
|
/**
|
|
@@ -10702,7 +10734,7 @@ const ws = class ws extends et {
|
|
|
10702
10734
|
*/
|
|
10703
10735
|
I(ws, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
|
|
10704
10736
|
let Sn = ws;
|
|
10705
|
-
class qr extends
|
|
10737
|
+
class qr extends Li {
|
|
10706
10738
|
constructor() {
|
|
10707
10739
|
super(...arguments);
|
|
10708
10740
|
/**
|
|
@@ -10978,7 +11010,7 @@ const Ds = class Ds extends et {
|
|
|
10978
11010
|
* @throws Will throw an error if the fragment manager is not available.
|
|
10979
11011
|
*/
|
|
10980
11012
|
getVolumeFromFragments(t) {
|
|
10981
|
-
const e = this.components.get(
|
|
11013
|
+
const e = this.components.get(ht), i = new g.Matrix4(), o = [];
|
|
10982
11014
|
for (const r in t) {
|
|
10983
11015
|
const a = e.list.get(r);
|
|
10984
11016
|
if (!a)
|
|
@@ -11021,13 +11053,9 @@ const Ds = class Ds extends et {
|
|
|
11021
11053
|
*/
|
|
11022
11054
|
getVolumeFromMeshes(t) {
|
|
11023
11055
|
let e = 0;
|
|
11024
|
-
for (const
|
|
11025
|
-
e += this.getVolumeOfMesh(
|
|
11026
|
-
|
|
11027
|
-
for (const n of t)
|
|
11028
|
-
n.geometry.computeBoundingSphere(), i.addMesh(n);
|
|
11029
|
-
const o = i.getSphere();
|
|
11030
|
-
return i.reset(), { volume: e, sphere: o };
|
|
11056
|
+
for (const i of t)
|
|
11057
|
+
e += this.getVolumeOfMesh(i);
|
|
11058
|
+
return e;
|
|
11031
11059
|
}
|
|
11032
11060
|
getFaceData(t, e, i) {
|
|
11033
11061
|
const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: c } = o;
|
|
@@ -11096,14 +11124,14 @@ I(Ds, "uuid", "267ca032-672f-4cb0-afa9-d24e904f39d6");
|
|
|
11096
11124
|
let Nn = Ds;
|
|
11097
11125
|
export {
|
|
11098
11126
|
Ts as AsyncEvent,
|
|
11099
|
-
|
|
11127
|
+
Si as Base,
|
|
11100
11128
|
ar as BaseCamera,
|
|
11101
11129
|
cr as BaseRenderer,
|
|
11102
11130
|
lr as BaseScene,
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11131
|
+
Ni as BaseWorldItem,
|
|
11132
|
+
Fn as BoundingBoxer,
|
|
11133
|
+
Ai as Classifier,
|
|
11134
|
+
Rn as Clipper,
|
|
11107
11135
|
et as Component,
|
|
11108
11136
|
pi as Components,
|
|
11109
11137
|
Yr as CullerRenderer,
|
|
@@ -11112,27 +11140,27 @@ export {
|
|
|
11112
11140
|
D as Event,
|
|
11113
11141
|
gn as Exploder,
|
|
11114
11142
|
zr as FirstPersonMode,
|
|
11115
|
-
|
|
11143
|
+
ht as FragmentsManager,
|
|
11116
11144
|
vn as GeometryTypes,
|
|
11117
|
-
|
|
11145
|
+
dn as Grids,
|
|
11118
11146
|
_n as Hider,
|
|
11119
11147
|
oa as IfcCategories,
|
|
11120
11148
|
Bn as IfcCategoryMap,
|
|
11121
11149
|
Zr as IfcElements,
|
|
11122
|
-
|
|
11150
|
+
Li as IfcFragmentSettings,
|
|
11123
11151
|
Sn as IfcGeometryTiler,
|
|
11124
|
-
|
|
11125
|
-
|
|
11152
|
+
mi as IfcJsonExporter,
|
|
11153
|
+
Ri as IfcLoader,
|
|
11126
11154
|
On as IfcPropertiesManager,
|
|
11127
11155
|
Kr as IfcPropertiesTiler,
|
|
11128
11156
|
Kt as IfcPropertiesUtils,
|
|
11129
11157
|
ke as IfcRelationsIndexer,
|
|
11130
11158
|
jr as IfcStreamingSettings,
|
|
11131
|
-
|
|
11159
|
+
sn as MaterialsUtils,
|
|
11132
11160
|
Nn as MeasurementUtils,
|
|
11133
11161
|
Vr as MeshCullerRenderer,
|
|
11134
11162
|
Gr as MiniMap,
|
|
11135
|
-
|
|
11163
|
+
An as MiniMaps,
|
|
11136
11164
|
Rr as Mouse,
|
|
11137
11165
|
Hr as OrbitMode,
|
|
11138
11166
|
na as OrthoPerspectiveCamera,
|
|
@@ -11142,7 +11170,7 @@ export {
|
|
|
11142
11170
|
ze as Raycasters,
|
|
11143
11171
|
He as SimpleCamera,
|
|
11144
11172
|
Nr as SimpleGrid,
|
|
11145
|
-
|
|
11173
|
+
Pi as SimplePlane,
|
|
11146
11174
|
Ar as SimpleRaycaster,
|
|
11147
11175
|
ia as SimpleRenderer,
|
|
11148
11176
|
sa as SimpleScene,
|