@thatopen/components 2.4.2 → 2.4.4
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/ifc/IfcPropertiesManager/index.d.ts +1 -1
- package/dist/index.cjs +938 -93
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +3 -3
- package/dist/index.mjs +939 -94
- package/dist/namespace.d.ts +4125 -4094
- package/dist/openbim/IDSSpecifications/src/facets/Property.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/section-generator.d.ts +31 -0
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -2041,27 +2041,27 @@ function iterateOverTriangles_indirect(offset, count, bvh, intersectsTriangleFun
|
|
|
2041
2041
|
return false;
|
|
2042
2042
|
}
|
|
2043
2043
|
const _boxIntersection$3 = /* @__PURE__ */ new THREE$1.Vector3();
|
|
2044
|
-
function raycast(bvh, root, side, ray2,
|
|
2044
|
+
function raycast(bvh, root, side, ray2, intersects2) {
|
|
2045
2045
|
BufferStack.setBuffer(bvh._roots[root]);
|
|
2046
|
-
_raycast$1(0, bvh, side, ray2,
|
|
2046
|
+
_raycast$1(0, bvh, side, ray2, intersects2);
|
|
2047
2047
|
BufferStack.clearBuffer();
|
|
2048
2048
|
}
|
|
2049
|
-
function _raycast$1(nodeIndex32, bvh, side, ray2,
|
|
2049
|
+
function _raycast$1(nodeIndex32, bvh, side, ray2, intersects2) {
|
|
2050
2050
|
const { float32Array, uint16Array, uint32Array } = BufferStack;
|
|
2051
2051
|
const nodeIndex16 = nodeIndex32 * 2;
|
|
2052
2052
|
const isLeaf = IS_LEAF(nodeIndex16, uint16Array);
|
|
2053
2053
|
if (isLeaf) {
|
|
2054
2054
|
const offset = OFFSET(nodeIndex32, uint32Array);
|
|
2055
2055
|
const count = COUNT(nodeIndex16, uint16Array);
|
|
2056
|
-
intersectTris(bvh, side, ray2, offset, count,
|
|
2056
|
+
intersectTris(bvh, side, ray2, offset, count, intersects2);
|
|
2057
2057
|
} else {
|
|
2058
2058
|
const leftIndex = LEFT_NODE(nodeIndex32);
|
|
2059
2059
|
if (intersectRay(leftIndex, float32Array, ray2, _boxIntersection$3)) {
|
|
2060
|
-
_raycast$1(leftIndex, bvh, side, ray2,
|
|
2060
|
+
_raycast$1(leftIndex, bvh, side, ray2, intersects2);
|
|
2061
2061
|
}
|
|
2062
2062
|
const rightIndex = RIGHT_NODE(nodeIndex32, uint32Array);
|
|
2063
2063
|
if (intersectRay(rightIndex, float32Array, ray2, _boxIntersection$3)) {
|
|
2064
|
-
_raycast$1(rightIndex, bvh, side, ray2,
|
|
2064
|
+
_raycast$1(rightIndex, bvh, side, ray2, intersects2);
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
@@ -2447,27 +2447,27 @@ function refit_indirect(bvh, nodeIndices = null) {
|
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
2449
|
const _boxIntersection$1 = /* @__PURE__ */ new THREE$1.Vector3();
|
|
2450
|
-
function raycast_indirect(bvh, root, side, ray2,
|
|
2450
|
+
function raycast_indirect(bvh, root, side, ray2, intersects2) {
|
|
2451
2451
|
BufferStack.setBuffer(bvh._roots[root]);
|
|
2452
|
-
_raycast(0, bvh, side, ray2,
|
|
2452
|
+
_raycast(0, bvh, side, ray2, intersects2);
|
|
2453
2453
|
BufferStack.clearBuffer();
|
|
2454
2454
|
}
|
|
2455
|
-
function _raycast(nodeIndex32, bvh, side, ray2,
|
|
2455
|
+
function _raycast(nodeIndex32, bvh, side, ray2, intersects2) {
|
|
2456
2456
|
const { float32Array, uint16Array, uint32Array } = BufferStack;
|
|
2457
2457
|
const nodeIndex16 = nodeIndex32 * 2;
|
|
2458
2458
|
const isLeaf = IS_LEAF(nodeIndex16, uint16Array);
|
|
2459
2459
|
if (isLeaf) {
|
|
2460
2460
|
const offset = OFFSET(nodeIndex32, uint32Array);
|
|
2461
2461
|
const count = COUNT(nodeIndex16, uint16Array);
|
|
2462
|
-
intersectTris_indirect(bvh, side, ray2, offset, count,
|
|
2462
|
+
intersectTris_indirect(bvh, side, ray2, offset, count, intersects2);
|
|
2463
2463
|
} else {
|
|
2464
2464
|
const leftIndex = LEFT_NODE(nodeIndex32);
|
|
2465
2465
|
if (intersectRay(leftIndex, float32Array, ray2, _boxIntersection$1)) {
|
|
2466
|
-
_raycast(leftIndex, bvh, side, ray2,
|
|
2466
|
+
_raycast(leftIndex, bvh, side, ray2, intersects2);
|
|
2467
2467
|
}
|
|
2468
2468
|
const rightIndex = RIGHT_NODE(nodeIndex32, uint32Array);
|
|
2469
2469
|
if (intersectRay(rightIndex, float32Array, ray2, _boxIntersection$1)) {
|
|
2470
|
-
_raycast(rightIndex, bvh, side, ray2,
|
|
2470
|
+
_raycast(rightIndex, bvh, side, ray2, intersects2);
|
|
2471
2471
|
}
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
@@ -3139,7 +3139,7 @@ class MeshBVH {
|
|
|
3139
3139
|
raycast(ray2, materialOrSide = THREE$1.FrontSide) {
|
|
3140
3140
|
const roots = this._roots;
|
|
3141
3141
|
const geometry = this.geometry;
|
|
3142
|
-
const
|
|
3142
|
+
const intersects2 = [];
|
|
3143
3143
|
const isMaterial = materialOrSide.isMaterial;
|
|
3144
3144
|
const isArrayMaterial = Array.isArray(materialOrSide);
|
|
3145
3145
|
const groups = geometry.groups;
|
|
@@ -3147,16 +3147,16 @@ class MeshBVH {
|
|
|
3147
3147
|
const raycastFunc = this.indirect ? raycast_indirect : raycast;
|
|
3148
3148
|
for (let i = 0, l = roots.length; i < l; i++) {
|
|
3149
3149
|
const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;
|
|
3150
|
-
const startCount =
|
|
3151
|
-
raycastFunc(this, i, materialSide, ray2,
|
|
3150
|
+
const startCount = intersects2.length;
|
|
3151
|
+
raycastFunc(this, i, materialSide, ray2, intersects2);
|
|
3152
3152
|
if (isArrayMaterial) {
|
|
3153
3153
|
const materialIndex = groups[i].materialIndex;
|
|
3154
|
-
for (let j = startCount, jl =
|
|
3155
|
-
|
|
3154
|
+
for (let j = startCount, jl = intersects2.length; j < jl; j++) {
|
|
3155
|
+
intersects2[j].face.materialIndex = materialIndex;
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
3158
|
}
|
|
3159
|
-
return
|
|
3159
|
+
return intersects2;
|
|
3160
3160
|
}
|
|
3161
3161
|
raycastFirst(ray2, materialOrSide = THREE$1.FrontSide) {
|
|
3162
3162
|
const roots = this._roots;
|
|
@@ -3354,7 +3354,7 @@ function convertRaycastIntersect(hit, object, raycaster) {
|
|
|
3354
3354
|
const ray = /* @__PURE__ */ new THREE$1.Ray();
|
|
3355
3355
|
const tmpInverseMatrix = /* @__PURE__ */ new THREE$1.Matrix4();
|
|
3356
3356
|
const origMeshRaycastFunc = THREE$1.Mesh.prototype.raycast;
|
|
3357
|
-
function acceleratedRaycast(raycaster,
|
|
3357
|
+
function acceleratedRaycast(raycaster, intersects2) {
|
|
3358
3358
|
if (this.geometry.boundsTree) {
|
|
3359
3359
|
if (this.material === void 0)
|
|
3360
3360
|
return;
|
|
@@ -3364,19 +3364,19 @@ function acceleratedRaycast(raycaster, intersects) {
|
|
|
3364
3364
|
if (raycaster.firstHitOnly === true) {
|
|
3365
3365
|
const hit = convertRaycastIntersect(bvh.raycastFirst(ray, this.material), this, raycaster);
|
|
3366
3366
|
if (hit) {
|
|
3367
|
-
|
|
3367
|
+
intersects2.push(hit);
|
|
3368
3368
|
}
|
|
3369
3369
|
} else {
|
|
3370
3370
|
const hits = bvh.raycast(ray, this.material);
|
|
3371
3371
|
for (let i = 0, l = hits.length; i < l; i++) {
|
|
3372
3372
|
const hit = convertRaycastIntersect(hits[i], this, raycaster);
|
|
3373
3373
|
if (hit) {
|
|
3374
|
-
|
|
3374
|
+
intersects2.push(hit);
|
|
3375
3375
|
}
|
|
3376
3376
|
}
|
|
3377
3377
|
}
|
|
3378
3378
|
} else {
|
|
3379
|
-
origMeshRaycastFunc.call(this, raycaster,
|
|
3379
|
+
origMeshRaycastFunc.call(this, raycaster, intersects2);
|
|
3380
3380
|
}
|
|
3381
3381
|
}
|
|
3382
3382
|
function computeBoundsTree(options) {
|
|
@@ -4751,15 +4751,15 @@ function obbFromPoints(vertices) {
|
|
|
4751
4751
|
mean.add(p).add(q).add(r).divideScalar(3);
|
|
4752
4752
|
qp.subVectors(q, p);
|
|
4753
4753
|
rp.subVectors(r, p);
|
|
4754
|
-
const
|
|
4755
|
-
weightedMean.add(v.copy(mean).multiplyScalar(
|
|
4756
|
-
areaSum +=
|
|
4757
|
-
cxx += (9 * mean.x * mean.x + p.x * p.x + q.x * q.x + r.x * r.x) * (
|
|
4758
|
-
cxy += (9 * mean.x * mean.y + p.x * p.y + q.x * q.y + r.x * r.y) * (
|
|
4759
|
-
cxz += (9 * mean.x * mean.z + p.x * p.z + q.x * q.z + r.x * r.z) * (
|
|
4760
|
-
cyy += (9 * mean.y * mean.y + p.y * p.y + q.y * q.y + r.y * r.y) * (
|
|
4761
|
-
cyz += (9 * mean.y * mean.z + p.y * p.z + q.y * q.z + r.y * r.z) * (
|
|
4762
|
-
czz += (9 * mean.z * mean.z + p.z * p.z + q.z * q.z + r.z * r.z) * (
|
|
4754
|
+
const area2 = v.crossVectors(qp, rp).length() / 2;
|
|
4755
|
+
weightedMean.add(v.copy(mean).multiplyScalar(area2));
|
|
4756
|
+
areaSum += area2;
|
|
4757
|
+
cxx += (9 * mean.x * mean.x + p.x * p.x + q.x * q.x + r.x * r.x) * (area2 / 12);
|
|
4758
|
+
cxy += (9 * mean.x * mean.y + p.x * p.y + q.x * q.y + r.x * r.y) * (area2 / 12);
|
|
4759
|
+
cxz += (9 * mean.x * mean.z + p.x * p.z + q.x * q.z + r.x * r.z) * (area2 / 12);
|
|
4760
|
+
cyy += (9 * mean.y * mean.y + p.y * p.y + q.y * q.y + r.y * r.y) * (area2 / 12);
|
|
4761
|
+
cyz += (9 * mean.y * mean.z + p.y * p.z + q.y * q.z + r.y * r.z) * (area2 / 12);
|
|
4762
|
+
czz += (9 * mean.z * mean.z + p.z * p.z + q.z * q.z + r.z * r.z) * (area2 / 12);
|
|
4763
4763
|
}
|
|
4764
4764
|
weightedMean.divideScalar(areaSum);
|
|
4765
4765
|
cxx /= areaSum;
|
|
@@ -5251,15 +5251,15 @@ class VertexPicker extends Component {
|
|
|
5251
5251
|
return this._pickedPoint;
|
|
5252
5252
|
const casters = this.components.get(Raycasters);
|
|
5253
5253
|
const caster = casters.get(world);
|
|
5254
|
-
const
|
|
5255
|
-
if (!
|
|
5254
|
+
const intersects2 = caster.castRay();
|
|
5255
|
+
if (!intersects2) {
|
|
5256
5256
|
if (this._pickedPoint !== null) {
|
|
5257
5257
|
this.onVertexLost.trigger();
|
|
5258
5258
|
this._pickedPoint = null;
|
|
5259
5259
|
}
|
|
5260
5260
|
return this._pickedPoint;
|
|
5261
5261
|
}
|
|
5262
|
-
const point = this.getClosestVertex(
|
|
5262
|
+
const point = this.getClosestVertex(intersects2);
|
|
5263
5263
|
if (!point) {
|
|
5264
5264
|
if (this._pickedPoint !== null) {
|
|
5265
5265
|
this.onVertexLost.trigger();
|
|
@@ -5278,11 +5278,11 @@ class VertexPicker extends Component {
|
|
|
5278
5278
|
}
|
|
5279
5279
|
return this._pickedPoint;
|
|
5280
5280
|
}
|
|
5281
|
-
getClosestVertex(
|
|
5281
|
+
getClosestVertex(intersects2) {
|
|
5282
5282
|
let closestVertex = new THREE__namespace.Vector3();
|
|
5283
5283
|
let vertexFound = false;
|
|
5284
5284
|
let closestDistance = Number.MAX_SAFE_INTEGER;
|
|
5285
|
-
const vertices = this.getVertices(
|
|
5285
|
+
const vertices = this.getVertices(intersects2);
|
|
5286
5286
|
if (vertices === null) {
|
|
5287
5287
|
return null;
|
|
5288
5288
|
}
|
|
@@ -5290,35 +5290,35 @@ class VertexPicker extends Component {
|
|
|
5290
5290
|
if (!vertex) {
|
|
5291
5291
|
continue;
|
|
5292
5292
|
}
|
|
5293
|
-
const distance =
|
|
5293
|
+
const distance = intersects2.point.distanceTo(vertex);
|
|
5294
5294
|
if (distance > closestDistance || distance > this._config.snapDistance) {
|
|
5295
5295
|
continue;
|
|
5296
5296
|
}
|
|
5297
5297
|
vertexFound = true;
|
|
5298
5298
|
closestVertex = vertex;
|
|
5299
|
-
closestDistance =
|
|
5299
|
+
closestDistance = intersects2.point.distanceTo(vertex);
|
|
5300
5300
|
}
|
|
5301
5301
|
if (vertexFound) {
|
|
5302
5302
|
return closestVertex;
|
|
5303
5303
|
}
|
|
5304
|
-
return this.config.showOnlyVertex ? null :
|
|
5304
|
+
return this.config.showOnlyVertex ? null : intersects2.point;
|
|
5305
5305
|
}
|
|
5306
|
-
getVertices(
|
|
5307
|
-
const mesh =
|
|
5308
|
-
if (!
|
|
5306
|
+
getVertices(intersects2) {
|
|
5307
|
+
const mesh = intersects2.object;
|
|
5308
|
+
if (!intersects2.face || !mesh)
|
|
5309
5309
|
return null;
|
|
5310
5310
|
const geom = mesh.geometry;
|
|
5311
5311
|
const instanceTransform = new THREE__namespace.Matrix4();
|
|
5312
|
-
const { instanceId } =
|
|
5312
|
+
const { instanceId } = intersects2;
|
|
5313
5313
|
const instanceFound = instanceId !== void 0;
|
|
5314
5314
|
const isInstance = mesh instanceof THREE__namespace.InstancedMesh;
|
|
5315
5315
|
if (isInstance && instanceFound) {
|
|
5316
5316
|
mesh.getMatrixAt(instanceId, instanceTransform);
|
|
5317
5317
|
}
|
|
5318
5318
|
return [
|
|
5319
|
-
this.getVertex(
|
|
5320
|
-
this.getVertex(
|
|
5321
|
-
this.getVertex(
|
|
5319
|
+
this.getVertex(intersects2.face.a, geom),
|
|
5320
|
+
this.getVertex(intersects2.face.b, geom),
|
|
5321
|
+
this.getVertex(intersects2.face.c, geom)
|
|
5322
5322
|
].map((vertex) => {
|
|
5323
5323
|
if (vertex) {
|
|
5324
5324
|
if (isInstance && instanceFound) {
|
|
@@ -5340,6 +5340,840 @@ class VertexPicker extends Component {
|
|
|
5340
5340
|
);
|
|
5341
5341
|
}
|
|
5342
5342
|
}
|
|
5343
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
5344
|
+
function getDefaultExportFromCjs(x) {
|
|
5345
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5346
|
+
}
|
|
5347
|
+
var earcut$2 = { exports: {} };
|
|
5348
|
+
earcut$2.exports = earcut;
|
|
5349
|
+
earcut$2.exports.default = earcut;
|
|
5350
|
+
function earcut(data, holeIndices, dim) {
|
|
5351
|
+
dim = dim || 2;
|
|
5352
|
+
var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];
|
|
5353
|
+
if (!outerNode || outerNode.next === outerNode.prev)
|
|
5354
|
+
return triangles;
|
|
5355
|
+
var minX, minY, maxX, maxY, x, y, invSize;
|
|
5356
|
+
if (hasHoles)
|
|
5357
|
+
outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
5358
|
+
if (data.length > 80 * dim) {
|
|
5359
|
+
minX = maxX = data[0];
|
|
5360
|
+
minY = maxY = data[1];
|
|
5361
|
+
for (var i = dim; i < outerLen; i += dim) {
|
|
5362
|
+
x = data[i];
|
|
5363
|
+
y = data[i + 1];
|
|
5364
|
+
if (x < minX)
|
|
5365
|
+
minX = x;
|
|
5366
|
+
if (y < minY)
|
|
5367
|
+
minY = y;
|
|
5368
|
+
if (x > maxX)
|
|
5369
|
+
maxX = x;
|
|
5370
|
+
if (y > maxY)
|
|
5371
|
+
maxY = y;
|
|
5372
|
+
}
|
|
5373
|
+
invSize = Math.max(maxX - minX, maxY - minY);
|
|
5374
|
+
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
5375
|
+
}
|
|
5376
|
+
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
5377
|
+
return triangles;
|
|
5378
|
+
}
|
|
5379
|
+
function linkedList(data, start, end, dim, clockwise) {
|
|
5380
|
+
var i, last;
|
|
5381
|
+
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
5382
|
+
for (i = start; i < end; i += dim)
|
|
5383
|
+
last = insertNode(i, data[i], data[i + 1], last);
|
|
5384
|
+
} else {
|
|
5385
|
+
for (i = end - dim; i >= start; i -= dim)
|
|
5386
|
+
last = insertNode(i, data[i], data[i + 1], last);
|
|
5387
|
+
}
|
|
5388
|
+
if (last && equals(last, last.next)) {
|
|
5389
|
+
removeNode(last);
|
|
5390
|
+
last = last.next;
|
|
5391
|
+
}
|
|
5392
|
+
return last;
|
|
5393
|
+
}
|
|
5394
|
+
function filterPoints(start, end) {
|
|
5395
|
+
if (!start)
|
|
5396
|
+
return start;
|
|
5397
|
+
if (!end)
|
|
5398
|
+
end = start;
|
|
5399
|
+
var p = start, again;
|
|
5400
|
+
do {
|
|
5401
|
+
again = false;
|
|
5402
|
+
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
5403
|
+
removeNode(p);
|
|
5404
|
+
p = end = p.prev;
|
|
5405
|
+
if (p === p.next)
|
|
5406
|
+
break;
|
|
5407
|
+
again = true;
|
|
5408
|
+
} else {
|
|
5409
|
+
p = p.next;
|
|
5410
|
+
}
|
|
5411
|
+
} while (again || p !== end);
|
|
5412
|
+
return end;
|
|
5413
|
+
}
|
|
5414
|
+
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
5415
|
+
if (!ear)
|
|
5416
|
+
return;
|
|
5417
|
+
if (!pass && invSize)
|
|
5418
|
+
indexCurve(ear, minX, minY, invSize);
|
|
5419
|
+
var stop = ear, prev, next;
|
|
5420
|
+
while (ear.prev !== ear.next) {
|
|
5421
|
+
prev = ear.prev;
|
|
5422
|
+
next = ear.next;
|
|
5423
|
+
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
5424
|
+
triangles.push(prev.i / dim | 0);
|
|
5425
|
+
triangles.push(ear.i / dim | 0);
|
|
5426
|
+
triangles.push(next.i / dim | 0);
|
|
5427
|
+
removeNode(ear);
|
|
5428
|
+
ear = next.next;
|
|
5429
|
+
stop = next.next;
|
|
5430
|
+
continue;
|
|
5431
|
+
}
|
|
5432
|
+
ear = next;
|
|
5433
|
+
if (ear === stop) {
|
|
5434
|
+
if (!pass) {
|
|
5435
|
+
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
5436
|
+
} else if (pass === 1) {
|
|
5437
|
+
ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
|
|
5438
|
+
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
5439
|
+
} else if (pass === 2) {
|
|
5440
|
+
splitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
5441
|
+
}
|
|
5442
|
+
break;
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
function isEar(ear) {
|
|
5447
|
+
var a = ear.prev, b = ear, c = ear.next;
|
|
5448
|
+
if (area(a, b, c) >= 0)
|
|
5449
|
+
return false;
|
|
5450
|
+
var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
5451
|
+
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
5452
|
+
var p = c.next;
|
|
5453
|
+
while (p !== a) {
|
|
5454
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
|
|
5455
|
+
return false;
|
|
5456
|
+
p = p.next;
|
|
5457
|
+
}
|
|
5458
|
+
return true;
|
|
5459
|
+
}
|
|
5460
|
+
function isEarHashed(ear, minX, minY, invSize) {
|
|
5461
|
+
var a = ear.prev, b = ear, c = ear.next;
|
|
5462
|
+
if (area(a, b, c) >= 0)
|
|
5463
|
+
return false;
|
|
5464
|
+
var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
5465
|
+
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
5466
|
+
var minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
5467
|
+
var p = ear.prevZ, n = ear.nextZ;
|
|
5468
|
+
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
5469
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
|
|
5470
|
+
return false;
|
|
5471
|
+
p = p.prevZ;
|
|
5472
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0)
|
|
5473
|
+
return false;
|
|
5474
|
+
n = n.nextZ;
|
|
5475
|
+
}
|
|
5476
|
+
while (p && p.z >= minZ) {
|
|
5477
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
|
|
5478
|
+
return false;
|
|
5479
|
+
p = p.prevZ;
|
|
5480
|
+
}
|
|
5481
|
+
while (n && n.z <= maxZ) {
|
|
5482
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0)
|
|
5483
|
+
return false;
|
|
5484
|
+
n = n.nextZ;
|
|
5485
|
+
}
|
|
5486
|
+
return true;
|
|
5487
|
+
}
|
|
5488
|
+
function cureLocalIntersections(start, triangles, dim) {
|
|
5489
|
+
var p = start;
|
|
5490
|
+
do {
|
|
5491
|
+
var a = p.prev, b = p.next.next;
|
|
5492
|
+
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
5493
|
+
triangles.push(a.i / dim | 0);
|
|
5494
|
+
triangles.push(p.i / dim | 0);
|
|
5495
|
+
triangles.push(b.i / dim | 0);
|
|
5496
|
+
removeNode(p);
|
|
5497
|
+
removeNode(p.next);
|
|
5498
|
+
p = start = b;
|
|
5499
|
+
}
|
|
5500
|
+
p = p.next;
|
|
5501
|
+
} while (p !== start);
|
|
5502
|
+
return filterPoints(p);
|
|
5503
|
+
}
|
|
5504
|
+
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
5505
|
+
var a = start;
|
|
5506
|
+
do {
|
|
5507
|
+
var b = a.next.next;
|
|
5508
|
+
while (b !== a.prev) {
|
|
5509
|
+
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
5510
|
+
var c = splitPolygon(a, b);
|
|
5511
|
+
a = filterPoints(a, a.next);
|
|
5512
|
+
c = filterPoints(c, c.next);
|
|
5513
|
+
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
5514
|
+
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
5515
|
+
return;
|
|
5516
|
+
}
|
|
5517
|
+
b = b.next;
|
|
5518
|
+
}
|
|
5519
|
+
a = a.next;
|
|
5520
|
+
} while (a !== start);
|
|
5521
|
+
}
|
|
5522
|
+
function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
5523
|
+
var queue = [], i, len, start, end, list;
|
|
5524
|
+
for (i = 0, len = holeIndices.length; i < len; i++) {
|
|
5525
|
+
start = holeIndices[i] * dim;
|
|
5526
|
+
end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
5527
|
+
list = linkedList(data, start, end, dim, false);
|
|
5528
|
+
if (list === list.next)
|
|
5529
|
+
list.steiner = true;
|
|
5530
|
+
queue.push(getLeftmost(list));
|
|
5531
|
+
}
|
|
5532
|
+
queue.sort(compareX);
|
|
5533
|
+
for (i = 0; i < queue.length; i++) {
|
|
5534
|
+
outerNode = eliminateHole(queue[i], outerNode);
|
|
5535
|
+
}
|
|
5536
|
+
return outerNode;
|
|
5537
|
+
}
|
|
5538
|
+
function compareX(a, b) {
|
|
5539
|
+
return a.x - b.x;
|
|
5540
|
+
}
|
|
5541
|
+
function eliminateHole(hole, outerNode) {
|
|
5542
|
+
var bridge = findHoleBridge(hole, outerNode);
|
|
5543
|
+
if (!bridge) {
|
|
5544
|
+
return outerNode;
|
|
5545
|
+
}
|
|
5546
|
+
var bridgeReverse = splitPolygon(bridge, hole);
|
|
5547
|
+
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
5548
|
+
return filterPoints(bridge, bridge.next);
|
|
5549
|
+
}
|
|
5550
|
+
function findHoleBridge(hole, outerNode) {
|
|
5551
|
+
var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
|
|
5552
|
+
do {
|
|
5553
|
+
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
|
|
5554
|
+
var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
|
|
5555
|
+
if (x <= hx && x > qx) {
|
|
5556
|
+
qx = x;
|
|
5557
|
+
m = p.x < p.next.x ? p : p.next;
|
|
5558
|
+
if (x === hx)
|
|
5559
|
+
return m;
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
p = p.next;
|
|
5563
|
+
} while (p !== outerNode);
|
|
5564
|
+
if (!m)
|
|
5565
|
+
return null;
|
|
5566
|
+
var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
|
|
5567
|
+
p = m;
|
|
5568
|
+
do {
|
|
5569
|
+
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
5570
|
+
tan = Math.abs(hy - p.y) / (hx - p.x);
|
|
5571
|
+
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
|
|
5572
|
+
m = p;
|
|
5573
|
+
tanMin = tan;
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
p = p.next;
|
|
5577
|
+
} while (p !== stop);
|
|
5578
|
+
return m;
|
|
5579
|
+
}
|
|
5580
|
+
function sectorContainsSector(m, p) {
|
|
5581
|
+
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
|
|
5582
|
+
}
|
|
5583
|
+
function indexCurve(start, minX, minY, invSize) {
|
|
5584
|
+
var p = start;
|
|
5585
|
+
do {
|
|
5586
|
+
if (p.z === 0)
|
|
5587
|
+
p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
5588
|
+
p.prevZ = p.prev;
|
|
5589
|
+
p.nextZ = p.next;
|
|
5590
|
+
p = p.next;
|
|
5591
|
+
} while (p !== start);
|
|
5592
|
+
p.prevZ.nextZ = null;
|
|
5593
|
+
p.prevZ = null;
|
|
5594
|
+
sortLinked(p);
|
|
5595
|
+
}
|
|
5596
|
+
function sortLinked(list) {
|
|
5597
|
+
var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
|
|
5598
|
+
do {
|
|
5599
|
+
p = list;
|
|
5600
|
+
list = null;
|
|
5601
|
+
tail = null;
|
|
5602
|
+
numMerges = 0;
|
|
5603
|
+
while (p) {
|
|
5604
|
+
numMerges++;
|
|
5605
|
+
q = p;
|
|
5606
|
+
pSize = 0;
|
|
5607
|
+
for (i = 0; i < inSize; i++) {
|
|
5608
|
+
pSize++;
|
|
5609
|
+
q = q.nextZ;
|
|
5610
|
+
if (!q)
|
|
5611
|
+
break;
|
|
5612
|
+
}
|
|
5613
|
+
qSize = inSize;
|
|
5614
|
+
while (pSize > 0 || qSize > 0 && q) {
|
|
5615
|
+
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
|
|
5616
|
+
e = p;
|
|
5617
|
+
p = p.nextZ;
|
|
5618
|
+
pSize--;
|
|
5619
|
+
} else {
|
|
5620
|
+
e = q;
|
|
5621
|
+
q = q.nextZ;
|
|
5622
|
+
qSize--;
|
|
5623
|
+
}
|
|
5624
|
+
if (tail)
|
|
5625
|
+
tail.nextZ = e;
|
|
5626
|
+
else
|
|
5627
|
+
list = e;
|
|
5628
|
+
e.prevZ = tail;
|
|
5629
|
+
tail = e;
|
|
5630
|
+
}
|
|
5631
|
+
p = q;
|
|
5632
|
+
}
|
|
5633
|
+
tail.nextZ = null;
|
|
5634
|
+
inSize *= 2;
|
|
5635
|
+
} while (numMerges > 1);
|
|
5636
|
+
return list;
|
|
5637
|
+
}
|
|
5638
|
+
function zOrder(x, y, minX, minY, invSize) {
|
|
5639
|
+
x = (x - minX) * invSize | 0;
|
|
5640
|
+
y = (y - minY) * invSize | 0;
|
|
5641
|
+
x = (x | x << 8) & 16711935;
|
|
5642
|
+
x = (x | x << 4) & 252645135;
|
|
5643
|
+
x = (x | x << 2) & 858993459;
|
|
5644
|
+
x = (x | x << 1) & 1431655765;
|
|
5645
|
+
y = (y | y << 8) & 16711935;
|
|
5646
|
+
y = (y | y << 4) & 252645135;
|
|
5647
|
+
y = (y | y << 2) & 858993459;
|
|
5648
|
+
y = (y | y << 1) & 1431655765;
|
|
5649
|
+
return x | y << 1;
|
|
5650
|
+
}
|
|
5651
|
+
function getLeftmost(start) {
|
|
5652
|
+
var p = start, leftmost = start;
|
|
5653
|
+
do {
|
|
5654
|
+
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y)
|
|
5655
|
+
leftmost = p;
|
|
5656
|
+
p = p.next;
|
|
5657
|
+
} while (p !== start);
|
|
5658
|
+
return leftmost;
|
|
5659
|
+
}
|
|
5660
|
+
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
5661
|
+
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
5662
|
+
}
|
|
5663
|
+
function isValidDiagonal(a, b) {
|
|
5664
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
|
|
5665
|
+
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
5666
|
+
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
5667
|
+
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
|
|
5668
|
+
}
|
|
5669
|
+
function area(p, q, r) {
|
|
5670
|
+
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
5671
|
+
}
|
|
5672
|
+
function equals(p1, p2) {
|
|
5673
|
+
return p1.x === p2.x && p1.y === p2.y;
|
|
5674
|
+
}
|
|
5675
|
+
function intersects(p1, q1, p2, q2) {
|
|
5676
|
+
var o1 = sign(area(p1, q1, p2));
|
|
5677
|
+
var o2 = sign(area(p1, q1, q2));
|
|
5678
|
+
var o3 = sign(area(p2, q2, p1));
|
|
5679
|
+
var o4 = sign(area(p2, q2, q1));
|
|
5680
|
+
if (o1 !== o2 && o3 !== o4)
|
|
5681
|
+
return true;
|
|
5682
|
+
if (o1 === 0 && onSegment(p1, p2, q1))
|
|
5683
|
+
return true;
|
|
5684
|
+
if (o2 === 0 && onSegment(p1, q2, q1))
|
|
5685
|
+
return true;
|
|
5686
|
+
if (o3 === 0 && onSegment(p2, p1, q2))
|
|
5687
|
+
return true;
|
|
5688
|
+
if (o4 === 0 && onSegment(p2, q1, q2))
|
|
5689
|
+
return true;
|
|
5690
|
+
return false;
|
|
5691
|
+
}
|
|
5692
|
+
function onSegment(p, q, r) {
|
|
5693
|
+
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
5694
|
+
}
|
|
5695
|
+
function sign(num) {
|
|
5696
|
+
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
5697
|
+
}
|
|
5698
|
+
function intersectsPolygon(a, b) {
|
|
5699
|
+
var p = a;
|
|
5700
|
+
do {
|
|
5701
|
+
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b))
|
|
5702
|
+
return true;
|
|
5703
|
+
p = p.next;
|
|
5704
|
+
} while (p !== a);
|
|
5705
|
+
return false;
|
|
5706
|
+
}
|
|
5707
|
+
function locallyInside(a, b) {
|
|
5708
|
+
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
|
|
5709
|
+
}
|
|
5710
|
+
function middleInside(a, b) {
|
|
5711
|
+
var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
|
|
5712
|
+
do {
|
|
5713
|
+
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
|
|
5714
|
+
inside = !inside;
|
|
5715
|
+
p = p.next;
|
|
5716
|
+
} while (p !== a);
|
|
5717
|
+
return inside;
|
|
5718
|
+
}
|
|
5719
|
+
function splitPolygon(a, b) {
|
|
5720
|
+
var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;
|
|
5721
|
+
a.next = b;
|
|
5722
|
+
b.prev = a;
|
|
5723
|
+
a2.next = an;
|
|
5724
|
+
an.prev = a2;
|
|
5725
|
+
b2.next = a2;
|
|
5726
|
+
a2.prev = b2;
|
|
5727
|
+
bp.next = b2;
|
|
5728
|
+
b2.prev = bp;
|
|
5729
|
+
return b2;
|
|
5730
|
+
}
|
|
5731
|
+
function insertNode(i, x, y, last) {
|
|
5732
|
+
var p = new Node(i, x, y);
|
|
5733
|
+
if (!last) {
|
|
5734
|
+
p.prev = p;
|
|
5735
|
+
p.next = p;
|
|
5736
|
+
} else {
|
|
5737
|
+
p.next = last.next;
|
|
5738
|
+
p.prev = last;
|
|
5739
|
+
last.next.prev = p;
|
|
5740
|
+
last.next = p;
|
|
5741
|
+
}
|
|
5742
|
+
return p;
|
|
5743
|
+
}
|
|
5744
|
+
function removeNode(p) {
|
|
5745
|
+
p.next.prev = p.prev;
|
|
5746
|
+
p.prev.next = p.next;
|
|
5747
|
+
if (p.prevZ)
|
|
5748
|
+
p.prevZ.nextZ = p.nextZ;
|
|
5749
|
+
if (p.nextZ)
|
|
5750
|
+
p.nextZ.prevZ = p.prevZ;
|
|
5751
|
+
}
|
|
5752
|
+
function Node(i, x, y) {
|
|
5753
|
+
this.i = i;
|
|
5754
|
+
this.x = x;
|
|
5755
|
+
this.y = y;
|
|
5756
|
+
this.prev = null;
|
|
5757
|
+
this.next = null;
|
|
5758
|
+
this.z = 0;
|
|
5759
|
+
this.prevZ = null;
|
|
5760
|
+
this.nextZ = null;
|
|
5761
|
+
this.steiner = false;
|
|
5762
|
+
}
|
|
5763
|
+
earcut.deviation = function(data, holeIndices, dim, triangles) {
|
|
5764
|
+
var hasHoles = holeIndices && holeIndices.length;
|
|
5765
|
+
var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
5766
|
+
var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
|
|
5767
|
+
if (hasHoles) {
|
|
5768
|
+
for (var i = 0, len = holeIndices.length; i < len; i++) {
|
|
5769
|
+
var start = holeIndices[i] * dim;
|
|
5770
|
+
var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
5771
|
+
polygonArea -= Math.abs(signedArea(data, start, end, dim));
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
var trianglesArea = 0;
|
|
5775
|
+
for (i = 0; i < triangles.length; i += 3) {
|
|
5776
|
+
var a = triangles[i] * dim;
|
|
5777
|
+
var b = triangles[i + 1] * dim;
|
|
5778
|
+
var c = triangles[i + 2] * dim;
|
|
5779
|
+
trianglesArea += Math.abs(
|
|
5780
|
+
(data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1])
|
|
5781
|
+
);
|
|
5782
|
+
}
|
|
5783
|
+
return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
5784
|
+
};
|
|
5785
|
+
function signedArea(data, start, end, dim) {
|
|
5786
|
+
var sum = 0;
|
|
5787
|
+
for (var i = start, j = end - dim; i < end; i += dim) {
|
|
5788
|
+
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
5789
|
+
j = i;
|
|
5790
|
+
}
|
|
5791
|
+
return sum;
|
|
5792
|
+
}
|
|
5793
|
+
earcut.flatten = function(data) {
|
|
5794
|
+
var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
|
|
5795
|
+
for (var i = 0; i < data.length; i++) {
|
|
5796
|
+
for (var j = 0; j < data[i].length; j++) {
|
|
5797
|
+
for (var d = 0; d < dim; d++)
|
|
5798
|
+
result.vertices.push(data[i][j][d]);
|
|
5799
|
+
}
|
|
5800
|
+
if (i > 0) {
|
|
5801
|
+
holeIndex += data[i - 1].length;
|
|
5802
|
+
result.holes.push(holeIndex);
|
|
5803
|
+
}
|
|
5804
|
+
}
|
|
5805
|
+
return result;
|
|
5806
|
+
};
|
|
5807
|
+
var earcutExports = earcut$2.exports;
|
|
5808
|
+
const earcut$1 = /* @__PURE__ */ getDefaultExportFromCjs(earcutExports);
|
|
5809
|
+
class SectionGenerator extends Component {
|
|
5810
|
+
constructor() {
|
|
5811
|
+
super(...arguments);
|
|
5812
|
+
__publicField(this, "enabled", true);
|
|
5813
|
+
__publicField(this, "_inverseMatrix", new THREE__namespace.Matrix4());
|
|
5814
|
+
__publicField(this, "_localPlane", new THREE__namespace.Plane());
|
|
5815
|
+
__publicField(this, "_tempLine", new THREE__namespace.Line3());
|
|
5816
|
+
__publicField(this, "_tempVector", new THREE__namespace.Vector3());
|
|
5817
|
+
__publicField(this, "_plane");
|
|
5818
|
+
__publicField(this, "_plane2DCoordinateSystem", new THREE__namespace.Matrix4());
|
|
5819
|
+
__publicField(this, "_precission", 1e4);
|
|
5820
|
+
// Used if the plane is orthogonal to the cartesian planes
|
|
5821
|
+
__publicField(this, "_planeAxis");
|
|
5822
|
+
}
|
|
5823
|
+
get plane() {
|
|
5824
|
+
if (!this._plane) {
|
|
5825
|
+
throw new Error("Plane not set");
|
|
5826
|
+
}
|
|
5827
|
+
return this._plane;
|
|
5828
|
+
}
|
|
5829
|
+
set plane(plane) {
|
|
5830
|
+
this._plane = plane;
|
|
5831
|
+
}
|
|
5832
|
+
// This assumes that the mesh that contains the posAttr is aligned with the current plane
|
|
5833
|
+
createEdges(data) {
|
|
5834
|
+
const { meshes, posAttr } = data;
|
|
5835
|
+
let index = 0;
|
|
5836
|
+
posAttr.array.fill(0);
|
|
5837
|
+
const indexes = [];
|
|
5838
|
+
let lastIndex = 0;
|
|
5839
|
+
const tempMesh = new THREE__namespace.Mesh();
|
|
5840
|
+
for (const mesh of meshes) {
|
|
5841
|
+
if (!mesh.geometry) {
|
|
5842
|
+
continue;
|
|
5843
|
+
}
|
|
5844
|
+
if (!mesh.geometry.boundsTree) {
|
|
5845
|
+
mesh.geometry.computeBoundsTree();
|
|
5846
|
+
}
|
|
5847
|
+
if (!mesh.geometry.boundsTree) {
|
|
5848
|
+
throw new Error("Bounds tree not found for edges generation.");
|
|
5849
|
+
}
|
|
5850
|
+
if (mesh instanceof THREE__namespace.InstancedMesh) {
|
|
5851
|
+
if (mesh.count === 0) {
|
|
5852
|
+
continue;
|
|
5853
|
+
}
|
|
5854
|
+
const instanced = mesh;
|
|
5855
|
+
for (let i = 0; i < instanced.count; i++) {
|
|
5856
|
+
tempMesh.geometry = mesh.geometry;
|
|
5857
|
+
tempMesh.matrix.copy(mesh.matrix);
|
|
5858
|
+
const tempMatrix2 = new THREE__namespace.Matrix4();
|
|
5859
|
+
instanced.getMatrixAt(i, tempMatrix2);
|
|
5860
|
+
tempMesh.applyMatrix4(tempMatrix2);
|
|
5861
|
+
tempMesh.applyMatrix4(mesh.matrixWorld);
|
|
5862
|
+
tempMesh.updateMatrix();
|
|
5863
|
+
tempMesh.updateMatrixWorld();
|
|
5864
|
+
this._inverseMatrix.copy(tempMesh.matrixWorld).invert();
|
|
5865
|
+
this._localPlane.copy(this.plane).applyMatrix4(this._inverseMatrix);
|
|
5866
|
+
index = this.shapecast(tempMesh, posAttr, index);
|
|
5867
|
+
if (index !== lastIndex) {
|
|
5868
|
+
indexes.push(index);
|
|
5869
|
+
lastIndex = index;
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5872
|
+
} else {
|
|
5873
|
+
this._inverseMatrix.copy(mesh.matrixWorld).invert();
|
|
5874
|
+
this._localPlane.copy(this.plane).applyMatrix4(this._inverseMatrix);
|
|
5875
|
+
index = this.shapecast(mesh, posAttr, index);
|
|
5876
|
+
if (index !== lastIndex) {
|
|
5877
|
+
indexes.push(index);
|
|
5878
|
+
lastIndex = index;
|
|
5879
|
+
}
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5882
|
+
return { indexes, index };
|
|
5883
|
+
}
|
|
5884
|
+
createFills(buffer, trianglesIndices) {
|
|
5885
|
+
this.updatePlane2DCoordinateSystem();
|
|
5886
|
+
const allIndices = [];
|
|
5887
|
+
let currentTriangle = 0;
|
|
5888
|
+
for (let i = 0; i < trianglesIndices.length; i++) {
|
|
5889
|
+
const nextTriangle = trianglesIndices[i];
|
|
5890
|
+
const vertices = [];
|
|
5891
|
+
for (let j = currentTriangle; j < nextTriangle; j += 2) {
|
|
5892
|
+
vertices.push(j * 3);
|
|
5893
|
+
}
|
|
5894
|
+
const indices = this.computeFill(vertices, buffer);
|
|
5895
|
+
for (const index of indices) {
|
|
5896
|
+
allIndices.push(index);
|
|
5897
|
+
}
|
|
5898
|
+
currentTriangle = nextTriangle;
|
|
5899
|
+
}
|
|
5900
|
+
return allIndices;
|
|
5901
|
+
}
|
|
5902
|
+
computeFill(vertices, buffer) {
|
|
5903
|
+
const indices = /* @__PURE__ */ new Map();
|
|
5904
|
+
const all2DVertices = {};
|
|
5905
|
+
const shapes = /* @__PURE__ */ new Map();
|
|
5906
|
+
let nextShapeID = 0;
|
|
5907
|
+
const shapesEnds = /* @__PURE__ */ new Map();
|
|
5908
|
+
const shapesStarts = /* @__PURE__ */ new Map();
|
|
5909
|
+
const openShapes = /* @__PURE__ */ new Set();
|
|
5910
|
+
const p = this._precission;
|
|
5911
|
+
for (let i = 0; i < vertices.length; i++) {
|
|
5912
|
+
const startVertexIndex = vertices[i];
|
|
5913
|
+
let x1 = 0;
|
|
5914
|
+
let y1 = 0;
|
|
5915
|
+
let x2 = 0;
|
|
5916
|
+
let y2 = 0;
|
|
5917
|
+
const globalX1 = buffer[startVertexIndex];
|
|
5918
|
+
const globalY1 = buffer[startVertexIndex + 1];
|
|
5919
|
+
const globalZ1 = buffer[startVertexIndex + 2];
|
|
5920
|
+
const globalX2 = buffer[startVertexIndex + 3];
|
|
5921
|
+
const globalY2 = buffer[startVertexIndex + 4];
|
|
5922
|
+
const globalZ2 = buffer[startVertexIndex + 5];
|
|
5923
|
+
this._tempVector.set(globalX1, globalY1, globalZ1);
|
|
5924
|
+
this._tempVector.applyMatrix4(this._plane2DCoordinateSystem);
|
|
5925
|
+
x1 = Math.trunc(this._tempVector.x * p) / p;
|
|
5926
|
+
y1 = Math.trunc(this._tempVector.y * p) / p;
|
|
5927
|
+
this._tempVector.set(globalX2, globalY2, globalZ2);
|
|
5928
|
+
this._tempVector.applyMatrix4(this._plane2DCoordinateSystem);
|
|
5929
|
+
x2 = Math.trunc(this._tempVector.x * p) / p;
|
|
5930
|
+
y2 = Math.trunc(this._tempVector.y * p) / p;
|
|
5931
|
+
if (x1 === x2 && y1 === y2) {
|
|
5932
|
+
continue;
|
|
5933
|
+
}
|
|
5934
|
+
const startCode = `${x1}|${y1}`;
|
|
5935
|
+
const endCode = `${x2}|${y2}`;
|
|
5936
|
+
if (!indices.has(startCode)) {
|
|
5937
|
+
indices.set(startCode, startVertexIndex / 3);
|
|
5938
|
+
}
|
|
5939
|
+
if (!indices.has(endCode)) {
|
|
5940
|
+
indices.set(endCode, startVertexIndex / 3 + 1);
|
|
5941
|
+
}
|
|
5942
|
+
const start = indices.get(startCode);
|
|
5943
|
+
const end = indices.get(endCode);
|
|
5944
|
+
all2DVertices[start] = [x1, y1];
|
|
5945
|
+
all2DVertices[end] = [x2, y2];
|
|
5946
|
+
const startMatchesStart = shapesStarts.has(start);
|
|
5947
|
+
const startMatchesEnd = shapesEnds.has(start);
|
|
5948
|
+
const endMatchesStart = shapesStarts.has(end);
|
|
5949
|
+
const endMatchesEnd = shapesEnds.has(end);
|
|
5950
|
+
const noMatches = !startMatchesStart && !startMatchesEnd && !endMatchesStart && !endMatchesEnd;
|
|
5951
|
+
if (noMatches) {
|
|
5952
|
+
shapesStarts.set(start, nextShapeID);
|
|
5953
|
+
shapesEnds.set(end, nextShapeID);
|
|
5954
|
+
openShapes.add(nextShapeID);
|
|
5955
|
+
shapes.set(nextShapeID, [start, end]);
|
|
5956
|
+
nextShapeID++;
|
|
5957
|
+
} else if (startMatchesStart && endMatchesEnd) {
|
|
5958
|
+
const startIndex = shapesStarts.get(start);
|
|
5959
|
+
const endIndex = shapesEnds.get(end);
|
|
5960
|
+
const isShapeMerge = startIndex !== endIndex;
|
|
5961
|
+
if (isShapeMerge) {
|
|
5962
|
+
const endShape = shapes.get(endIndex);
|
|
5963
|
+
const startShape = shapes.get(startIndex);
|
|
5964
|
+
if (!endShape || !startShape) {
|
|
5965
|
+
continue;
|
|
5966
|
+
}
|
|
5967
|
+
shapes.delete(startIndex);
|
|
5968
|
+
openShapes.delete(startIndex);
|
|
5969
|
+
shapesEnds.set(startShape[startShape.length - 1], endIndex);
|
|
5970
|
+
shapesEnds.delete(endShape[endShape.length - 1]);
|
|
5971
|
+
for (const index of startShape) {
|
|
5972
|
+
endShape.push(index);
|
|
5973
|
+
}
|
|
5974
|
+
} else {
|
|
5975
|
+
openShapes.delete(endIndex);
|
|
5976
|
+
}
|
|
5977
|
+
shapesStarts.delete(start);
|
|
5978
|
+
shapesEnds.delete(end);
|
|
5979
|
+
} else if (startMatchesEnd && endMatchesStart) {
|
|
5980
|
+
const startIndex = shapesStarts.get(end);
|
|
5981
|
+
const endIndex = shapesEnds.get(start);
|
|
5982
|
+
const isShapeMerge = startIndex !== endIndex;
|
|
5983
|
+
if (isShapeMerge) {
|
|
5984
|
+
const endShape = shapes.get(endIndex);
|
|
5985
|
+
const startShape = shapes.get(startIndex);
|
|
5986
|
+
if (!endShape || !startShape) {
|
|
5987
|
+
continue;
|
|
5988
|
+
}
|
|
5989
|
+
shapes.delete(startIndex);
|
|
5990
|
+
openShapes.delete(startIndex);
|
|
5991
|
+
shapesEnds.set(startShape[startShape.length - 1], endIndex);
|
|
5992
|
+
shapesEnds.delete(endShape[endShape.length - 1]);
|
|
5993
|
+
for (const index of startShape) {
|
|
5994
|
+
endShape.push(index);
|
|
5995
|
+
}
|
|
5996
|
+
} else {
|
|
5997
|
+
openShapes.delete(endIndex);
|
|
5998
|
+
}
|
|
5999
|
+
shapesStarts.delete(end);
|
|
6000
|
+
shapesEnds.delete(start);
|
|
6001
|
+
} else if (startMatchesStart && endMatchesStart) {
|
|
6002
|
+
const startIndex1 = shapesStarts.get(end);
|
|
6003
|
+
const startIndex2 = shapesStarts.get(start);
|
|
6004
|
+
const startShape2 = shapes.get(startIndex2);
|
|
6005
|
+
const startShape1 = shapes.get(startIndex1);
|
|
6006
|
+
if (!startShape2 || !startShape1) {
|
|
6007
|
+
continue;
|
|
6008
|
+
}
|
|
6009
|
+
shapes.delete(startIndex1);
|
|
6010
|
+
openShapes.delete(startIndex1);
|
|
6011
|
+
shapesStarts.delete(startShape2[0]);
|
|
6012
|
+
shapesStarts.delete(startShape1[0]);
|
|
6013
|
+
shapesEnds.delete(startShape1[startShape1.length - 1]);
|
|
6014
|
+
shapesStarts.set(startShape1[startShape1.length - 1], startIndex2);
|
|
6015
|
+
startShape1.reverse();
|
|
6016
|
+
startShape2.splice(0, 0, ...startShape1);
|
|
6017
|
+
} else if (startMatchesEnd && endMatchesEnd) {
|
|
6018
|
+
const endIndex1 = shapesEnds.get(end);
|
|
6019
|
+
const endIndex2 = shapesEnds.get(start);
|
|
6020
|
+
const endShape2 = shapes.get(endIndex2);
|
|
6021
|
+
const endShape1 = shapes.get(endIndex1);
|
|
6022
|
+
if (!endShape2 || !endShape1) {
|
|
6023
|
+
continue;
|
|
6024
|
+
}
|
|
6025
|
+
shapes.delete(endIndex1);
|
|
6026
|
+
openShapes.delete(endIndex1);
|
|
6027
|
+
shapesEnds.delete(endShape2[endShape2.length - 1]);
|
|
6028
|
+
shapesEnds.delete(endShape1[endShape1.length - 1]);
|
|
6029
|
+
shapesStarts.delete(endShape1[0]);
|
|
6030
|
+
shapesEnds.set(endShape1[0], endIndex2);
|
|
6031
|
+
endShape1.reverse();
|
|
6032
|
+
endShape2.push(...endShape1);
|
|
6033
|
+
} else if (startMatchesStart) {
|
|
6034
|
+
const shapeIndex = shapesStarts.get(start);
|
|
6035
|
+
const shape = shapes.get(shapeIndex);
|
|
6036
|
+
if (!shape) {
|
|
6037
|
+
continue;
|
|
6038
|
+
}
|
|
6039
|
+
shape.unshift(end);
|
|
6040
|
+
shapesStarts.delete(start);
|
|
6041
|
+
shapesStarts.set(end, shapeIndex);
|
|
6042
|
+
} else if (startMatchesEnd) {
|
|
6043
|
+
const shapeIndex = shapesEnds.get(start);
|
|
6044
|
+
const shape = shapes.get(shapeIndex);
|
|
6045
|
+
if (!shape) {
|
|
6046
|
+
continue;
|
|
6047
|
+
}
|
|
6048
|
+
shape.push(end);
|
|
6049
|
+
shapesEnds.delete(start);
|
|
6050
|
+
shapesEnds.set(end, shapeIndex);
|
|
6051
|
+
} else if (endMatchesStart) {
|
|
6052
|
+
const shapeIndex = shapesStarts.get(end);
|
|
6053
|
+
const shape = shapes.get(shapeIndex);
|
|
6054
|
+
if (!shape) {
|
|
6055
|
+
continue;
|
|
6056
|
+
}
|
|
6057
|
+
shape.unshift(start);
|
|
6058
|
+
shapesStarts.delete(end);
|
|
6059
|
+
shapesStarts.set(start, shapeIndex);
|
|
6060
|
+
} else if (endMatchesEnd) {
|
|
6061
|
+
const shapeIndex = shapesEnds.get(end);
|
|
6062
|
+
const shape = shapes.get(shapeIndex);
|
|
6063
|
+
if (!shape) {
|
|
6064
|
+
continue;
|
|
6065
|
+
}
|
|
6066
|
+
shape.push(start);
|
|
6067
|
+
shapesEnds.delete(end);
|
|
6068
|
+
shapesEnds.set(start, shapeIndex);
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
6071
|
+
const trueIndices = [];
|
|
6072
|
+
for (const [id, shape] of shapes) {
|
|
6073
|
+
if (openShapes.has(id)) {
|
|
6074
|
+
continue;
|
|
6075
|
+
}
|
|
6076
|
+
const vertices2 = [];
|
|
6077
|
+
const indexMap = /* @__PURE__ */ new Map();
|
|
6078
|
+
let counter = 0;
|
|
6079
|
+
for (const index of shape) {
|
|
6080
|
+
const vertex = all2DVertices[index];
|
|
6081
|
+
vertices2.push(vertex[0], vertex[1]);
|
|
6082
|
+
indexMap.set(counter++, index);
|
|
6083
|
+
}
|
|
6084
|
+
const result = earcut$1(vertices2);
|
|
6085
|
+
for (const index of result) {
|
|
6086
|
+
const trueIndex = indexMap.get(index);
|
|
6087
|
+
if (trueIndex === void 0) {
|
|
6088
|
+
throw new Error("Map error!");
|
|
6089
|
+
}
|
|
6090
|
+
trueIndices.push(trueIndex);
|
|
6091
|
+
}
|
|
6092
|
+
}
|
|
6093
|
+
return trueIndices;
|
|
6094
|
+
}
|
|
6095
|
+
updatePlane2DCoordinateSystem() {
|
|
6096
|
+
this._plane2DCoordinateSystem = new THREE__namespace.Matrix4();
|
|
6097
|
+
const xAxis = new THREE__namespace.Vector3(1, 0, 0);
|
|
6098
|
+
const yAxis = new THREE__namespace.Vector3(0, 1, 0);
|
|
6099
|
+
const zAxis = this.plane.normal;
|
|
6100
|
+
const pos = new THREE__namespace.Vector3();
|
|
6101
|
+
this.plane.coplanarPoint(pos);
|
|
6102
|
+
if (this._planeAxis === "x") {
|
|
6103
|
+
xAxis.crossVectors(yAxis, zAxis);
|
|
6104
|
+
} else if (this._planeAxis === "y") {
|
|
6105
|
+
yAxis.crossVectors(zAxis, xAxis);
|
|
6106
|
+
} else if (this._planeAxis === "z")
|
|
6107
|
+
;
|
|
6108
|
+
else {
|
|
6109
|
+
xAxis.crossVectors(yAxis, zAxis).normalize();
|
|
6110
|
+
yAxis.crossVectors(zAxis, xAxis);
|
|
6111
|
+
}
|
|
6112
|
+
this._plane2DCoordinateSystem.fromArray([
|
|
6113
|
+
xAxis.x,
|
|
6114
|
+
xAxis.y,
|
|
6115
|
+
xAxis.z,
|
|
6116
|
+
0,
|
|
6117
|
+
yAxis.x,
|
|
6118
|
+
yAxis.y,
|
|
6119
|
+
yAxis.z,
|
|
6120
|
+
0,
|
|
6121
|
+
zAxis.x,
|
|
6122
|
+
zAxis.y,
|
|
6123
|
+
zAxis.z,
|
|
6124
|
+
0,
|
|
6125
|
+
pos.x,
|
|
6126
|
+
pos.y,
|
|
6127
|
+
pos.z,
|
|
6128
|
+
1
|
|
6129
|
+
]);
|
|
6130
|
+
this._plane2DCoordinateSystem.invert();
|
|
6131
|
+
}
|
|
6132
|
+
shapecast(mesh, posAttr, index) {
|
|
6133
|
+
mesh.geometry.boundsTree.shapecast({
|
|
6134
|
+
intersectsBounds: (box) => {
|
|
6135
|
+
return this._localPlane.intersectsBox(box);
|
|
6136
|
+
},
|
|
6137
|
+
// @ts-ignore
|
|
6138
|
+
intersectsTriangle: (tri) => {
|
|
6139
|
+
let count = 0;
|
|
6140
|
+
this._tempLine.start.copy(tri.a);
|
|
6141
|
+
this._tempLine.end.copy(tri.b);
|
|
6142
|
+
if (this._localPlane.intersectLine(this._tempLine, this._tempVector)) {
|
|
6143
|
+
const result = this._tempVector.applyMatrix4(mesh.matrixWorld);
|
|
6144
|
+
posAttr.setXYZ(index, result.x, result.y, result.z);
|
|
6145
|
+
count++;
|
|
6146
|
+
index++;
|
|
6147
|
+
}
|
|
6148
|
+
this._tempLine.start.copy(tri.b);
|
|
6149
|
+
this._tempLine.end.copy(tri.c);
|
|
6150
|
+
if (this._localPlane.intersectLine(this._tempLine, this._tempVector)) {
|
|
6151
|
+
const result = this._tempVector.applyMatrix4(mesh.matrixWorld);
|
|
6152
|
+
posAttr.setXYZ(index, result.x, result.y, result.z);
|
|
6153
|
+
count++;
|
|
6154
|
+
index++;
|
|
6155
|
+
}
|
|
6156
|
+
this._tempLine.start.copy(tri.c);
|
|
6157
|
+
this._tempLine.end.copy(tri.a);
|
|
6158
|
+
if (this._localPlane.intersectLine(this._tempLine, this._tempVector)) {
|
|
6159
|
+
const result = this._tempVector.applyMatrix4(mesh.matrixWorld);
|
|
6160
|
+
posAttr.setXYZ(index, result.x, result.y, result.z);
|
|
6161
|
+
count++;
|
|
6162
|
+
index++;
|
|
6163
|
+
}
|
|
6164
|
+
if (count !== 2) {
|
|
6165
|
+
index -= count;
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
});
|
|
6169
|
+
return index;
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
/**
|
|
6173
|
+
* A unique identifier for the component.
|
|
6174
|
+
* This UUID is used to register the component within the Components system.
|
|
6175
|
+
*/
|
|
6176
|
+
__publicField(SectionGenerator, "uuid", "1a193b87-6376-46c8-9e65-62a1576fdb64");
|
|
5343
6177
|
const _Components = class _Components {
|
|
5344
6178
|
constructor() {
|
|
5345
6179
|
/** {@link Disposable.onDisposed} */
|
|
@@ -5478,7 +6312,7 @@ const _Components = class _Components {
|
|
|
5478
6312
|
/**
|
|
5479
6313
|
* The version of the @thatopen/components library.
|
|
5480
6314
|
*/
|
|
5481
|
-
__publicField(_Components, "release", "2.4.
|
|
6315
|
+
__publicField(_Components, "release", "2.4.4");
|
|
5482
6316
|
let Components = _Components;
|
|
5483
6317
|
class SimpleWorld extends Base {
|
|
5484
6318
|
constructor() {
|
|
@@ -8141,9 +8975,9 @@ class CameraControls extends EventDispatcher {
|
|
|
8141
8975
|
const origin = _v3C.addVectors(this._target, nearPlaneCorner);
|
|
8142
8976
|
_raycaster$1.set(origin, rayDirection);
|
|
8143
8977
|
_raycaster$1.far = this._spherical.radius + 1;
|
|
8144
|
-
const
|
|
8145
|
-
if (
|
|
8146
|
-
distance =
|
|
8978
|
+
const intersects2 = _raycaster$1.intersectObjects(this.colliderMeshes);
|
|
8979
|
+
if (intersects2.length !== 0 && intersects2[0].distance < distance) {
|
|
8980
|
+
distance = intersects2[0].distance;
|
|
8147
8981
|
}
|
|
8148
8982
|
}
|
|
8149
8983
|
return distance;
|
|
@@ -11567,9 +12401,9 @@ const _Clipper = class _Clipper extends Component {
|
|
|
11567
12401
|
create(world) {
|
|
11568
12402
|
const casters = this.components.get(Raycasters);
|
|
11569
12403
|
const caster = casters.get(world);
|
|
11570
|
-
const
|
|
11571
|
-
if (
|
|
11572
|
-
return this.createPlaneFromIntersection(world,
|
|
12404
|
+
const intersects2 = caster.castRay();
|
|
12405
|
+
if (intersects2) {
|
|
12406
|
+
return this.createPlaneFromIntersection(world, intersects2);
|
|
11573
12407
|
}
|
|
11574
12408
|
return null;
|
|
11575
12409
|
}
|
|
@@ -11646,9 +12480,9 @@ const _Clipper = class _Clipper extends Component {
|
|
|
11646
12480
|
const casters = this.components.get(Raycasters);
|
|
11647
12481
|
const caster = casters.get(world);
|
|
11648
12482
|
const meshes = this.getAllPlaneMeshes();
|
|
11649
|
-
const
|
|
11650
|
-
if (
|
|
11651
|
-
const found =
|
|
12483
|
+
const intersects2 = caster.castRay(meshes);
|
|
12484
|
+
if (intersects2) {
|
|
12485
|
+
const found = intersects2.object;
|
|
11652
12486
|
return this.list.find((p) => p.meshes.includes(found));
|
|
11653
12487
|
}
|
|
11654
12488
|
return void 0;
|
|
@@ -17162,10 +17996,6 @@ const _FragmentsManager = class _FragmentsManager extends Component {
|
|
|
17162
17996
|
*/
|
|
17163
17997
|
__publicField(_FragmentsManager, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
|
|
17164
17998
|
let FragmentsManager = _FragmentsManager;
|
|
17165
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
17166
|
-
function getDefaultExportFromCjs(x) {
|
|
17167
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
17168
|
-
}
|
|
17169
17999
|
function commonjsRequire(path) {
|
|
17170
18000
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
17171
18001
|
}
|
|
@@ -20276,10 +21106,8 @@ function readDocType$1(xmlData, i) {
|
|
|
20276
21106
|
i += 8;
|
|
20277
21107
|
else if (hasBody && isNotation(xmlData, i))
|
|
20278
21108
|
i += 9;
|
|
20279
|
-
else if (isComment)
|
|
20280
|
-
comment = true;
|
|
20281
21109
|
else
|
|
20282
|
-
|
|
21110
|
+
comment = true;
|
|
20283
21111
|
angleBracketsCount++;
|
|
20284
21112
|
exp = "";
|
|
20285
21113
|
} else if (xmlData[i] === ">") {
|
|
@@ -20323,11 +21151,6 @@ function readEntityExp(xmlData, i) {
|
|
|
20323
21151
|
}
|
|
20324
21152
|
return [entityName2, val2, i];
|
|
20325
21153
|
}
|
|
20326
|
-
function isComment(xmlData, i) {
|
|
20327
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-")
|
|
20328
|
-
return true;
|
|
20329
|
-
return false;
|
|
20330
|
-
}
|
|
20331
21154
|
function isEntity(xmlData, i) {
|
|
20332
21155
|
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y")
|
|
20333
21156
|
return true;
|
|
@@ -20382,13 +21205,13 @@ function toNumber$1(str, options = {}) {
|
|
|
20382
21205
|
} else {
|
|
20383
21206
|
const match = numRegex.exec(trimmedStr);
|
|
20384
21207
|
if (match) {
|
|
20385
|
-
const
|
|
21208
|
+
const sign2 = match[1];
|
|
20386
21209
|
const leadingZeros = match[2];
|
|
20387
21210
|
let numTrimmedByZeros = trimZeros(match[3]);
|
|
20388
21211
|
const eNotation = match[4] || match[6];
|
|
20389
|
-
if (!options.leadingZeros && leadingZeros.length > 0 &&
|
|
21212
|
+
if (!options.leadingZeros && leadingZeros.length > 0 && sign2 && trimmedStr[2] !== ".")
|
|
20390
21213
|
return str;
|
|
20391
|
-
else if (!options.leadingZeros && leadingZeros.length > 0 && !
|
|
21214
|
+
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign2 && trimmedStr[1] !== ".")
|
|
20392
21215
|
return str;
|
|
20393
21216
|
else {
|
|
20394
21217
|
const num = Number(trimmedStr);
|
|
@@ -20408,7 +21231,7 @@ function toNumber$1(str, options = {}) {
|
|
|
20408
21231
|
return num;
|
|
20409
21232
|
else if (numStr === numTrimmedByZeros)
|
|
20410
21233
|
return num;
|
|
20411
|
-
else if (
|
|
21234
|
+
else if (sign2 && numStr === "-" + numTrimmedByZeros)
|
|
20412
21235
|
return num;
|
|
20413
21236
|
else
|
|
20414
21237
|
return str;
|
|
@@ -20416,14 +21239,14 @@ function toNumber$1(str, options = {}) {
|
|
|
20416
21239
|
if (leadingZeros) {
|
|
20417
21240
|
if (numTrimmedByZeros === numStr)
|
|
20418
21241
|
return num;
|
|
20419
|
-
else if (
|
|
21242
|
+
else if (sign2 + numTrimmedByZeros === numStr)
|
|
20420
21243
|
return num;
|
|
20421
21244
|
else
|
|
20422
21245
|
return str;
|
|
20423
21246
|
}
|
|
20424
21247
|
if (trimmedStr === numStr)
|
|
20425
21248
|
return num;
|
|
20426
|
-
else if (trimmedStr ===
|
|
21249
|
+
else if (trimmedStr === sign2 + numStr)
|
|
20427
21250
|
return num;
|
|
20428
21251
|
return str;
|
|
20429
21252
|
}
|
|
@@ -22368,7 +23191,7 @@ ${users}
|
|
|
22368
23191
|
Comment: CommentText,
|
|
22369
23192
|
Viewpoint: Viewpoint2
|
|
22370
23193
|
} = markupComment;
|
|
22371
|
-
if (!(Guid && CommentDate && Author &&
|
|
23194
|
+
if (!(Guid && CommentDate && Author && Comment))
|
|
22372
23195
|
return null;
|
|
22373
23196
|
const viewpoints = this.components.get(Viewpoints);
|
|
22374
23197
|
const comment = new Comment(this.components, CommentText ?? "");
|
|
@@ -26418,10 +27241,10 @@ class IDSFacet {
|
|
|
26418
27241
|
let minPass = true;
|
|
26419
27242
|
let maxPass = true;
|
|
26420
27243
|
if (min !== void 0) {
|
|
26421
|
-
minPass = minInclusive ? value
|
|
27244
|
+
minPass = minInclusive ? value >= min : value > min;
|
|
26422
27245
|
}
|
|
26423
27246
|
if (max !== void 0) {
|
|
26424
|
-
maxPass = maxInclusive ? value
|
|
27247
|
+
maxPass = maxInclusive ? value <= max : value < max;
|
|
26425
27248
|
}
|
|
26426
27249
|
pass = minPass && maxPass;
|
|
26427
27250
|
}
|
|
@@ -27146,16 +27969,15 @@ class IDSProperty extends IDSFacet {
|
|
|
27146
27969
|
this.testResult.push(result2);
|
|
27147
27970
|
const sets = await this.getPsets(model, expressID);
|
|
27148
27971
|
const matchingSets = sets.filter((set) => {
|
|
27149
|
-
var _a2;
|
|
27150
27972
|
const result3 = this.evalRequirement(
|
|
27151
|
-
|
|
27973
|
+
set.Name ?? null,
|
|
27152
27974
|
this.propertySet,
|
|
27153
27975
|
"PropertySet"
|
|
27154
27976
|
);
|
|
27155
27977
|
if (!result3)
|
|
27156
27978
|
return false;
|
|
27157
27979
|
checks.push({
|
|
27158
|
-
currentValue: set.Name
|
|
27980
|
+
currentValue: set.Name,
|
|
27159
27981
|
parameter: "PropertySet",
|
|
27160
27982
|
pass: true,
|
|
27161
27983
|
requiredValue: this.propertySet.parameter
|
|
@@ -27172,8 +27994,7 @@ class IDSProperty extends IDSFacet {
|
|
|
27172
27994
|
continue;
|
|
27173
27995
|
}
|
|
27174
27996
|
for (const set of matchingSets) {
|
|
27175
|
-
|
|
27176
|
-
if (!itemsAttrName) {
|
|
27997
|
+
if (!("Properties" in set)) {
|
|
27177
27998
|
checks.push({
|
|
27178
27999
|
currentValue: null,
|
|
27179
28000
|
parameter: "BaseName",
|
|
@@ -27182,7 +28003,7 @@ class IDSProperty extends IDSFacet {
|
|
|
27182
28003
|
});
|
|
27183
28004
|
continue;
|
|
27184
28005
|
}
|
|
27185
|
-
const items = set
|
|
28006
|
+
const items = set.Properties;
|
|
27186
28007
|
const matchingItems = items.filter((item) => {
|
|
27187
28008
|
var _a2;
|
|
27188
28009
|
if (this._unsupportedTypes.includes(item.type)) {
|
|
@@ -27237,18 +28058,22 @@ class IDSProperty extends IDSFacet {
|
|
|
27237
28058
|
(name) => name.endsWith("Value") || name.endsWith("Values")
|
|
27238
28059
|
);
|
|
27239
28060
|
}
|
|
27240
|
-
async
|
|
27241
|
-
|
|
28061
|
+
async simplifyPset(model, attrs, propsListName) {
|
|
28062
|
+
var _a;
|
|
27242
28063
|
const props = [];
|
|
27243
|
-
const list =
|
|
28064
|
+
const list = attrs[propsListName];
|
|
27244
28065
|
if (!list)
|
|
27245
|
-
return
|
|
28066
|
+
return attrs;
|
|
27246
28067
|
for (const { value } of list) {
|
|
27247
28068
|
const propAttrs = await model.getProperties(value);
|
|
27248
28069
|
if (propAttrs)
|
|
27249
28070
|
props.push(propAttrs);
|
|
27250
28071
|
}
|
|
27251
|
-
attrsClone
|
|
28072
|
+
const attrsClone = {
|
|
28073
|
+
Name: (_a = attrs.Name) == null ? void 0 : _a.value,
|
|
28074
|
+
Properties: props,
|
|
28075
|
+
type: attrs.type
|
|
28076
|
+
};
|
|
27252
28077
|
return attrsClone;
|
|
27253
28078
|
}
|
|
27254
28079
|
async getTypePsets(model, expressID) {
|
|
@@ -27266,13 +28091,14 @@ class IDSProperty extends IDSFacet {
|
|
|
27266
28091
|
if (!(psetAttrs && "HasProperties" in psetAttrs && Array.isArray(psetAttrs.HasProperties))) {
|
|
27267
28092
|
continue;
|
|
27268
28093
|
}
|
|
27269
|
-
const pset = await this.
|
|
28094
|
+
const pset = await this.simplifyPset(model, psetAttrs, "HasProperties");
|
|
27270
28095
|
sets.push(pset);
|
|
27271
28096
|
}
|
|
27272
28097
|
return sets;
|
|
27273
28098
|
}
|
|
27274
28099
|
async getPsets(model, expressID) {
|
|
27275
|
-
|
|
28100
|
+
var _a;
|
|
28101
|
+
const typePsets = await this.getTypePsets(model, expressID);
|
|
27276
28102
|
const indexer = this.components.get(IfcRelationsIndexer);
|
|
27277
28103
|
const definitions = indexer.getEntityRelations(
|
|
27278
28104
|
model,
|
|
@@ -27280,7 +28106,8 @@ class IDSProperty extends IDSFacet {
|
|
|
27280
28106
|
"IsDefinedBy"
|
|
27281
28107
|
);
|
|
27282
28108
|
if (!definitions)
|
|
27283
|
-
return
|
|
28109
|
+
return typePsets;
|
|
28110
|
+
const sets = [];
|
|
27284
28111
|
for (const definitionID of definitions) {
|
|
27285
28112
|
const attrs = await model.getProperties(definitionID);
|
|
27286
28113
|
if (!attrs)
|
|
@@ -27288,8 +28115,25 @@ class IDSProperty extends IDSFacet {
|
|
|
27288
28115
|
const propsListName = this.getItemsAttrName(attrs.type);
|
|
27289
28116
|
if (!propsListName)
|
|
27290
28117
|
continue;
|
|
27291
|
-
const
|
|
27292
|
-
|
|
28118
|
+
const occurencePset = await this.simplifyPset(
|
|
28119
|
+
model,
|
|
28120
|
+
attrs,
|
|
28121
|
+
propsListName
|
|
28122
|
+
);
|
|
28123
|
+
const typePset = typePsets.find(
|
|
28124
|
+
({ Name }) => Name === occurencePset.Name
|
|
28125
|
+
);
|
|
28126
|
+
if (typePset) {
|
|
28127
|
+
for (const prop of typePset.Properties) {
|
|
28128
|
+
const name = (_a = prop.Name) == null ? void 0 : _a.value;
|
|
28129
|
+
const existingProp = occurencePset.Properties.find(
|
|
28130
|
+
({ Name }) => Name.value === name
|
|
28131
|
+
);
|
|
28132
|
+
if (!existingProp)
|
|
28133
|
+
occurencePset.Properties.push(prop);
|
|
28134
|
+
}
|
|
28135
|
+
}
|
|
28136
|
+
sets.push(occurencePset);
|
|
27293
28137
|
}
|
|
27294
28138
|
return sets;
|
|
27295
28139
|
}
|
|
@@ -27820,6 +28664,7 @@ exports.PlanMode = PlanMode;
|
|
|
27820
28664
|
exports.ProjectionManager = ProjectionManager;
|
|
27821
28665
|
exports.PropertiesStreamingSettings = PropertiesStreamingSettings;
|
|
27822
28666
|
exports.Raycasters = Raycasters;
|
|
28667
|
+
exports.SectionGenerator = SectionGenerator;
|
|
27823
28668
|
exports.ShadowedScene = ShadowedScene;
|
|
27824
28669
|
exports.SimpleCamera = SimpleCamera;
|
|
27825
28670
|
exports.SimpleGrid = SimpleGrid;
|