circuit-json-to-gltf 0.0.73 → 0.0.74
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/index.js +274 -73
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -4378,6 +4378,52 @@ var require_isA3 = __commonJS({
|
|
|
4378
4378
|
}
|
|
4379
4379
|
});
|
|
4380
4380
|
|
|
4381
|
+
// node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js
|
|
4382
|
+
var require_isConvex2 = __commonJS({
|
|
4383
|
+
"node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js"(exports, module) {
|
|
4384
|
+
"use strict";
|
|
4385
|
+
var { EPS } = require_constants();
|
|
4386
|
+
var vec3 = require_vec3();
|
|
4387
|
+
var geom33 = require_isA3();
|
|
4388
|
+
var toPolygons3 = require_toPolygons();
|
|
4389
|
+
var poly3 = require_poly3();
|
|
4390
|
+
var isConvex = (geometry) => {
|
|
4391
|
+
if (!geom33(geometry)) {
|
|
4392
|
+
throw new Error("isConvex requires a geom3 geometry");
|
|
4393
|
+
}
|
|
4394
|
+
const polygons = toPolygons3(geometry);
|
|
4395
|
+
if (polygons.length === 0) {
|
|
4396
|
+
return true;
|
|
4397
|
+
}
|
|
4398
|
+
const vertices = [];
|
|
4399
|
+
const found = /* @__PURE__ */ new Set();
|
|
4400
|
+
for (let i = 0; i < polygons.length; i++) {
|
|
4401
|
+
const verts = polygons[i].vertices;
|
|
4402
|
+
for (let j = 0; j < verts.length; j++) {
|
|
4403
|
+
const v = verts[j];
|
|
4404
|
+
const key = `${v[0]},${v[1]},${v[2]}`;
|
|
4405
|
+
if (!found.has(key)) {
|
|
4406
|
+
found.add(key);
|
|
4407
|
+
vertices.push(v);
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
for (let i = 0; i < polygons.length; i++) {
|
|
4412
|
+
const plane = poly3.plane(polygons[i]);
|
|
4413
|
+
for (let j = 0; j < vertices.length; j++) {
|
|
4414
|
+
const v = vertices[j];
|
|
4415
|
+
const distance = vec3.dot(plane, v) - plane[3];
|
|
4416
|
+
if (distance > EPS) {
|
|
4417
|
+
return false;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
}
|
|
4421
|
+
return true;
|
|
4422
|
+
};
|
|
4423
|
+
module.exports = isConvex;
|
|
4424
|
+
}
|
|
4425
|
+
});
|
|
4426
|
+
|
|
4381
4427
|
// node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js
|
|
4382
4428
|
var require_toPoints3 = __commonJS({
|
|
4383
4429
|
"node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js"(exports, module) {
|
|
@@ -4535,6 +4581,7 @@ var require_geom3 = __commonJS({
|
|
|
4535
4581
|
fromCompactBinary: require_fromCompactBinary2(),
|
|
4536
4582
|
invert: require_invert3(),
|
|
4537
4583
|
isA: require_isA3(),
|
|
4584
|
+
isConvex: require_isConvex2(),
|
|
4538
4585
|
toPoints: require_toPoints3(),
|
|
4539
4586
|
toPolygons: require_toPolygons(),
|
|
4540
4587
|
toString: require_toString7(),
|
|
@@ -4731,7 +4778,7 @@ var require_appendArc = __commonJS({
|
|
|
4731
4778
|
} else if (sweepFlag && deltatheta < 0) {
|
|
4732
4779
|
deltatheta += TAU;
|
|
4733
4780
|
}
|
|
4734
|
-
let numsteps = Math.
|
|
4781
|
+
let numsteps = Math.floor(segments * (Math.abs(deltatheta) / TAU));
|
|
4735
4782
|
if (numsteps < 1) numsteps = 1;
|
|
4736
4783
|
for (let step = 1; step < numsteps; step++) {
|
|
4737
4784
|
const theta = theta1 + step / numsteps * deltatheta;
|
|
@@ -7200,7 +7247,7 @@ var require_arc = __commonJS({
|
|
|
7200
7247
|
vec2.add(point, point, centerv);
|
|
7201
7248
|
pointArray.push(point);
|
|
7202
7249
|
} else {
|
|
7203
|
-
const numsteps = Math.
|
|
7250
|
+
const numsteps = Math.floor(segments * (Math.abs(rotation) / TAU));
|
|
7204
7251
|
let edgestepsize = numsteps * 0.5 / rotation;
|
|
7205
7252
|
if (edgestepsize > 0.25) edgestepsize = 0.25;
|
|
7206
7253
|
const totalsteps = makeTangent ? numsteps + 2 : numsteps;
|
|
@@ -11233,6 +11280,205 @@ var require_intersect2 = __commonJS({
|
|
|
11233
11280
|
}
|
|
11234
11281
|
});
|
|
11235
11282
|
|
|
11283
|
+
// node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
|
|
11284
|
+
var require_hullPoints3 = __commonJS({
|
|
11285
|
+
"node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
|
|
11286
|
+
"use strict";
|
|
11287
|
+
var poly3 = require_poly3();
|
|
11288
|
+
var quickhull = require_quickhull();
|
|
11289
|
+
var hullPoints3 = (uniquePoints) => {
|
|
11290
|
+
const faces = quickhull(uniquePoints, { skipTriangulation: true });
|
|
11291
|
+
const polygons = faces.map((face) => {
|
|
11292
|
+
const vertices = face.map((index) => uniquePoints[index]);
|
|
11293
|
+
return poly3.create(vertices);
|
|
11294
|
+
});
|
|
11295
|
+
return polygons;
|
|
11296
|
+
};
|
|
11297
|
+
module.exports = hullPoints3;
|
|
11298
|
+
}
|
|
11299
|
+
});
|
|
11300
|
+
|
|
11301
|
+
// node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
|
|
11302
|
+
var require_unionGeom3Sub = __commonJS({
|
|
11303
|
+
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
|
|
11304
|
+
"use strict";
|
|
11305
|
+
var geom33 = require_geom3();
|
|
11306
|
+
var mayOverlap = require_mayOverlap();
|
|
11307
|
+
var { Tree } = require_trees();
|
|
11308
|
+
var unionSub = (geometry1, geometry2) => {
|
|
11309
|
+
if (!mayOverlap(geometry1, geometry2)) {
|
|
11310
|
+
return unionForNonIntersecting(geometry1, geometry2);
|
|
11311
|
+
}
|
|
11312
|
+
const a = new Tree(geom33.toPolygons(geometry1));
|
|
11313
|
+
const b = new Tree(geom33.toPolygons(geometry2));
|
|
11314
|
+
a.clipTo(b, false);
|
|
11315
|
+
b.clipTo(a);
|
|
11316
|
+
b.invert();
|
|
11317
|
+
b.clipTo(a);
|
|
11318
|
+
b.invert();
|
|
11319
|
+
const newpolygons = a.allPolygons().concat(b.allPolygons());
|
|
11320
|
+
const result = geom33.create(newpolygons);
|
|
11321
|
+
return result;
|
|
11322
|
+
};
|
|
11323
|
+
var unionForNonIntersecting = (geometry1, geometry2) => {
|
|
11324
|
+
let newpolygons = geom33.toPolygons(geometry1);
|
|
11325
|
+
newpolygons = newpolygons.concat(geom33.toPolygons(geometry2));
|
|
11326
|
+
return geom33.create(newpolygons);
|
|
11327
|
+
};
|
|
11328
|
+
module.exports = unionSub;
|
|
11329
|
+
}
|
|
11330
|
+
});
|
|
11331
|
+
|
|
11332
|
+
// node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
|
|
11333
|
+
var require_unionGeom3 = __commonJS({
|
|
11334
|
+
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
|
|
11335
|
+
"use strict";
|
|
11336
|
+
var flatten = require_flatten();
|
|
11337
|
+
var retessellate = require_retessellate();
|
|
11338
|
+
var unionSub = require_unionGeom3Sub();
|
|
11339
|
+
var union3 = (...geometries) => {
|
|
11340
|
+
geometries = flatten(geometries);
|
|
11341
|
+
let i;
|
|
11342
|
+
for (i = 1; i < geometries.length; i += 2) {
|
|
11343
|
+
geometries.push(unionSub(geometries[i - 1], geometries[i]));
|
|
11344
|
+
}
|
|
11345
|
+
let newgeometry = geometries[i - 1];
|
|
11346
|
+
newgeometry = retessellate(newgeometry);
|
|
11347
|
+
return newgeometry;
|
|
11348
|
+
};
|
|
11349
|
+
module.exports = union3;
|
|
11350
|
+
}
|
|
11351
|
+
});
|
|
11352
|
+
|
|
11353
|
+
// node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js
|
|
11354
|
+
var require_minkowskiSum = __commonJS({
|
|
11355
|
+
"node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js"(exports, module) {
|
|
11356
|
+
"use strict";
|
|
11357
|
+
var flatten = require_flatten();
|
|
11358
|
+
var geom33 = require_geom3();
|
|
11359
|
+
var poly3 = require_poly3();
|
|
11360
|
+
var hullPoints3 = require_hullPoints3();
|
|
11361
|
+
var unionGeom3 = require_unionGeom3();
|
|
11362
|
+
var minkowskiSum = (...geometries) => {
|
|
11363
|
+
geometries = flatten(geometries);
|
|
11364
|
+
if (geometries.length !== 2) {
|
|
11365
|
+
throw new Error("minkowskiSum requires exactly two geometries");
|
|
11366
|
+
}
|
|
11367
|
+
const [geomA, geomB] = geometries;
|
|
11368
|
+
if (!geom33.isA(geomA) || !geom33.isA(geomB)) {
|
|
11369
|
+
throw new Error("minkowskiSum requires geom3 geometries");
|
|
11370
|
+
}
|
|
11371
|
+
const aConvex = geom33.isConvex(geomA);
|
|
11372
|
+
const bConvex = geom33.isConvex(geomB);
|
|
11373
|
+
if (aConvex && bConvex) {
|
|
11374
|
+
return minkowskiSumConvex(geomA, geomB);
|
|
11375
|
+
}
|
|
11376
|
+
if (!aConvex && bConvex) {
|
|
11377
|
+
return minkowskiSumNonConvexConvex(geomA, geomB);
|
|
11378
|
+
}
|
|
11379
|
+
if (aConvex && !bConvex) {
|
|
11380
|
+
return minkowskiSumNonConvexConvex(geomB, geomA);
|
|
11381
|
+
}
|
|
11382
|
+
throw new Error("minkowskiSum of two non-convex geometries is not yet supported");
|
|
11383
|
+
};
|
|
11384
|
+
var minkowskiSumNonConvexConvex = (geomA, geomB) => {
|
|
11385
|
+
const tetrahedra = decomposeIntoTetrahedra(geomA);
|
|
11386
|
+
if (tetrahedra.length === 0) {
|
|
11387
|
+
return geom33.create();
|
|
11388
|
+
}
|
|
11389
|
+
const parts = tetrahedra.map((tet) => minkowskiSumConvex(tet, geomB));
|
|
11390
|
+
if (parts.length === 1) {
|
|
11391
|
+
return parts[0];
|
|
11392
|
+
}
|
|
11393
|
+
return unionGeom3(parts);
|
|
11394
|
+
};
|
|
11395
|
+
var decomposeIntoTetrahedra = (geometry) => {
|
|
11396
|
+
const polygons = geom33.toPolygons(geometry);
|
|
11397
|
+
if (polygons.length === 0) {
|
|
11398
|
+
return [];
|
|
11399
|
+
}
|
|
11400
|
+
const tetrahedra = [];
|
|
11401
|
+
for (let i = 0; i < polygons.length; i++) {
|
|
11402
|
+
const polygon3 = polygons[i];
|
|
11403
|
+
const vertices = polygon3.vertices;
|
|
11404
|
+
let cx = 0, cy = 0, cz = 0;
|
|
11405
|
+
for (let k = 0; k < vertices.length; k++) {
|
|
11406
|
+
cx += vertices[k][0];
|
|
11407
|
+
cy += vertices[k][1];
|
|
11408
|
+
cz += vertices[k][2];
|
|
11409
|
+
}
|
|
11410
|
+
cx /= vertices.length;
|
|
11411
|
+
cy /= vertices.length;
|
|
11412
|
+
cz /= vertices.length;
|
|
11413
|
+
const plane = poly3.plane(polygon3);
|
|
11414
|
+
const nx = plane[0], ny = plane[1], nz = plane[2];
|
|
11415
|
+
const offset = 0.1;
|
|
11416
|
+
const apex = [
|
|
11417
|
+
// Vertex used as apex in tetrahedron polygons below
|
|
11418
|
+
cx - nx * offset,
|
|
11419
|
+
cy - ny * offset,
|
|
11420
|
+
cz - nz * offset
|
|
11421
|
+
];
|
|
11422
|
+
for (let j = 1; j < vertices.length - 1; j++) {
|
|
11423
|
+
const v0 = vertices[0];
|
|
11424
|
+
const v1 = vertices[j];
|
|
11425
|
+
const v2 = vertices[j + 1];
|
|
11426
|
+
const tetPolygons = createTetrahedronPolygons(apex, v0, v1, v2);
|
|
11427
|
+
tetrahedra.push(geom33.create(tetPolygons));
|
|
11428
|
+
}
|
|
11429
|
+
}
|
|
11430
|
+
return tetrahedra;
|
|
11431
|
+
};
|
|
11432
|
+
var createTetrahedronPolygons = (p0, p1, p2, p3) => {
|
|
11433
|
+
return [
|
|
11434
|
+
poly3.create([p0, p2, p1]),
|
|
11435
|
+
// base seen from p3
|
|
11436
|
+
poly3.create([p0, p1, p3]),
|
|
11437
|
+
// face opposite p2
|
|
11438
|
+
poly3.create([p1, p2, p3]),
|
|
11439
|
+
// face opposite p0
|
|
11440
|
+
poly3.create([p2, p0, p3])
|
|
11441
|
+
// face opposite p1
|
|
11442
|
+
];
|
|
11443
|
+
};
|
|
11444
|
+
var minkowskiSumConvex = (geomA, geomB) => {
|
|
11445
|
+
const pointsA = extractUniqueVertices(geomA);
|
|
11446
|
+
const pointsB = extractUniqueVertices(geomB);
|
|
11447
|
+
if (pointsA.length === 0 || pointsB.length === 0) {
|
|
11448
|
+
return geom33.create();
|
|
11449
|
+
}
|
|
11450
|
+
const summedPoints = [];
|
|
11451
|
+
for (let i = 0; i < pointsA.length; i++) {
|
|
11452
|
+
const a = pointsA[i];
|
|
11453
|
+
for (let j = 0; j < pointsB.length; j++) {
|
|
11454
|
+
const b = pointsB[j];
|
|
11455
|
+
summedPoints.push([a[0] + b[0], a[1] + b[1], a[2] + b[2]]);
|
|
11456
|
+
}
|
|
11457
|
+
}
|
|
11458
|
+
const hullPolygons = hullPoints3(summedPoints);
|
|
11459
|
+
return geom33.create(hullPolygons);
|
|
11460
|
+
};
|
|
11461
|
+
var extractUniqueVertices = (geometry) => {
|
|
11462
|
+
const found = /* @__PURE__ */ new Set();
|
|
11463
|
+
const unique = [];
|
|
11464
|
+
const polygons = geom33.toPolygons(geometry);
|
|
11465
|
+
for (let i = 0; i < polygons.length; i++) {
|
|
11466
|
+
const vertices = polygons[i].vertices;
|
|
11467
|
+
for (let j = 0; j < vertices.length; j++) {
|
|
11468
|
+
const v = vertices[j];
|
|
11469
|
+
const key = `${v[0]},${v[1]},${v[2]}`;
|
|
11470
|
+
if (!found.has(key)) {
|
|
11471
|
+
found.add(key);
|
|
11472
|
+
unique.push(v);
|
|
11473
|
+
}
|
|
11474
|
+
}
|
|
11475
|
+
}
|
|
11476
|
+
return unique;
|
|
11477
|
+
};
|
|
11478
|
+
module.exports = minkowskiSum;
|
|
11479
|
+
}
|
|
11480
|
+
});
|
|
11481
|
+
|
|
11236
11482
|
// node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js
|
|
11237
11483
|
var require_scissionGeom3 = __commonJS({
|
|
11238
11484
|
"node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js"(exports, module) {
|
|
@@ -11421,58 +11667,6 @@ var require_subtract4 = __commonJS({
|
|
|
11421
11667
|
}
|
|
11422
11668
|
});
|
|
11423
11669
|
|
|
11424
|
-
// node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
|
|
11425
|
-
var require_unionGeom3Sub = __commonJS({
|
|
11426
|
-
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
|
|
11427
|
-
"use strict";
|
|
11428
|
-
var geom33 = require_geom3();
|
|
11429
|
-
var mayOverlap = require_mayOverlap();
|
|
11430
|
-
var { Tree } = require_trees();
|
|
11431
|
-
var unionSub = (geometry1, geometry2) => {
|
|
11432
|
-
if (!mayOverlap(geometry1, geometry2)) {
|
|
11433
|
-
return unionForNonIntersecting(geometry1, geometry2);
|
|
11434
|
-
}
|
|
11435
|
-
const a = new Tree(geom33.toPolygons(geometry1));
|
|
11436
|
-
const b = new Tree(geom33.toPolygons(geometry2));
|
|
11437
|
-
a.clipTo(b, false);
|
|
11438
|
-
b.clipTo(a);
|
|
11439
|
-
b.invert();
|
|
11440
|
-
b.clipTo(a);
|
|
11441
|
-
b.invert();
|
|
11442
|
-
const newpolygons = a.allPolygons().concat(b.allPolygons());
|
|
11443
|
-
const result = geom33.create(newpolygons);
|
|
11444
|
-
return result;
|
|
11445
|
-
};
|
|
11446
|
-
var unionForNonIntersecting = (geometry1, geometry2) => {
|
|
11447
|
-
let newpolygons = geom33.toPolygons(geometry1);
|
|
11448
|
-
newpolygons = newpolygons.concat(geom33.toPolygons(geometry2));
|
|
11449
|
-
return geom33.create(newpolygons);
|
|
11450
|
-
};
|
|
11451
|
-
module.exports = unionSub;
|
|
11452
|
-
}
|
|
11453
|
-
});
|
|
11454
|
-
|
|
11455
|
-
// node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
|
|
11456
|
-
var require_unionGeom3 = __commonJS({
|
|
11457
|
-
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
|
|
11458
|
-
"use strict";
|
|
11459
|
-
var flatten = require_flatten();
|
|
11460
|
-
var retessellate = require_retessellate();
|
|
11461
|
-
var unionSub = require_unionGeom3Sub();
|
|
11462
|
-
var union3 = (...geometries) => {
|
|
11463
|
-
geometries = flatten(geometries);
|
|
11464
|
-
let i;
|
|
11465
|
-
for (i = 1; i < geometries.length; i += 2) {
|
|
11466
|
-
geometries.push(unionSub(geometries[i - 1], geometries[i]));
|
|
11467
|
-
}
|
|
11468
|
-
let newgeometry = geometries[i - 1];
|
|
11469
|
-
newgeometry = retessellate(newgeometry);
|
|
11470
|
-
return newgeometry;
|
|
11471
|
-
};
|
|
11472
|
-
module.exports = union3;
|
|
11473
|
-
}
|
|
11474
|
-
});
|
|
11475
|
-
|
|
11476
11670
|
// node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js
|
|
11477
11671
|
var require_unionGeom2 = __commonJS({
|
|
11478
11672
|
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(exports, module) {
|
|
@@ -11525,6 +11719,7 @@ var require_booleans = __commonJS({
|
|
|
11525
11719
|
"use strict";
|
|
11526
11720
|
module.exports = {
|
|
11527
11721
|
intersect: require_intersect2(),
|
|
11722
|
+
minkowski: require_minkowskiSum(),
|
|
11528
11723
|
scission: require_scission(),
|
|
11529
11724
|
subtract: require_subtract4(),
|
|
11530
11725
|
union: require_union()
|
|
@@ -12564,24 +12759,6 @@ var require_hullGeom2 = __commonJS({
|
|
|
12564
12759
|
}
|
|
12565
12760
|
});
|
|
12566
12761
|
|
|
12567
|
-
// node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
|
|
12568
|
-
var require_hullPoints3 = __commonJS({
|
|
12569
|
-
"node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
|
|
12570
|
-
"use strict";
|
|
12571
|
-
var poly3 = require_poly3();
|
|
12572
|
-
var quickhull = require_quickhull();
|
|
12573
|
-
var hullPoints3 = (uniquePoints) => {
|
|
12574
|
-
const faces = quickhull(uniquePoints, { skipTriangulation: true });
|
|
12575
|
-
const polygons = faces.map((face) => {
|
|
12576
|
-
const vertices = face.map((index) => uniquePoints[index]);
|
|
12577
|
-
return poly3.create(vertices);
|
|
12578
|
-
});
|
|
12579
|
-
return polygons;
|
|
12580
|
-
};
|
|
12581
|
-
module.exports = hullPoints3;
|
|
12582
|
-
}
|
|
12583
|
-
});
|
|
12584
|
-
|
|
12585
12762
|
// node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js
|
|
12586
12763
|
var require_hullGeom3 = __commonJS({
|
|
12587
12764
|
"node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(exports, module) {
|
|
@@ -12661,6 +12838,16 @@ var require_hulls = __commonJS({
|
|
|
12661
12838
|
}
|
|
12662
12839
|
});
|
|
12663
12840
|
|
|
12841
|
+
// node_modules/@jscad/modeling/src/operations/minkowski/index.js
|
|
12842
|
+
var require_minkowski = __commonJS({
|
|
12843
|
+
"node_modules/@jscad/modeling/src/operations/minkowski/index.js"(exports, module) {
|
|
12844
|
+
"use strict";
|
|
12845
|
+
module.exports = {
|
|
12846
|
+
minkowskiSum: require_minkowskiSum()
|
|
12847
|
+
};
|
|
12848
|
+
}
|
|
12849
|
+
});
|
|
12850
|
+
|
|
12664
12851
|
// node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js
|
|
12665
12852
|
var require_snapPolygons = __commonJS({
|
|
12666
12853
|
"node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js"(exports, module) {
|
|
@@ -13502,6 +13689,7 @@ var require_src = __commonJS({
|
|
|
13502
13689
|
expansions: require_expansions(),
|
|
13503
13690
|
extrusions: require_extrusions(),
|
|
13504
13691
|
hulls: require_hulls(),
|
|
13692
|
+
minkowski: require_minkowski(),
|
|
13505
13693
|
modifiers: require_modifiers(),
|
|
13506
13694
|
transforms: require_transforms()
|
|
13507
13695
|
};
|
|
@@ -14613,7 +14801,20 @@ var occtModulePromise = null;
|
|
|
14613
14801
|
async function getOcctModule() {
|
|
14614
14802
|
if (!occtModulePromise) {
|
|
14615
14803
|
const occtimportjs = (await import("occt-import-js")).default;
|
|
14616
|
-
|
|
14804
|
+
const isBrowser = typeof window !== "undefined" || typeof self !== "undefined";
|
|
14805
|
+
if (isBrowser) {
|
|
14806
|
+
let wasmUrl;
|
|
14807
|
+
try {
|
|
14808
|
+
wasmUrl = (await import("occt-import-js/dist/occt-import-js.wasm?url")).default;
|
|
14809
|
+
} catch {
|
|
14810
|
+
wasmUrl = void 0;
|
|
14811
|
+
}
|
|
14812
|
+
occtModulePromise = occtimportjs({
|
|
14813
|
+
locateFile: (path) => path.endsWith(".wasm") && wasmUrl ? wasmUrl : path
|
|
14814
|
+
});
|
|
14815
|
+
} else {
|
|
14816
|
+
occtModulePromise = occtimportjs();
|
|
14817
|
+
}
|
|
14617
14818
|
}
|
|
14618
14819
|
return occtModulePromise;
|
|
14619
14820
|
}
|
package/package.json
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
"name": "circuit-json-to-gltf",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.74",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "bun test tests/",
|
|
8
|
+
"test:playwright": "playwright test",
|
|
8
9
|
"format": "biome format --write .",
|
|
9
10
|
"format:check": "biome format .",
|
|
10
11
|
"build:site": "cosmos-export",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@biomejs/biome": "^2.1.4",
|
|
27
|
+
"@playwright/test": "^1.58.2",
|
|
26
28
|
"@google/model-viewer": "^4.1.0",
|
|
27
29
|
"@resvg/resvg-js": "^2.6.2",
|
|
28
30
|
"@resvg/resvg-wasm": "^2.6.2",
|