circuit-json-to-gltf 0.0.42 → 0.0.44
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 +196 -248
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -722,7 +722,7 @@ var require_orthogonal = __commonJS({
|
|
|
722
722
|
var require_rotateX = __commonJS({
|
|
723
723
|
"node_modules/@jscad/modeling/src/maths/vec3/rotateX.js"(exports, module) {
|
|
724
724
|
"use strict";
|
|
725
|
-
var
|
|
725
|
+
var rotateX4 = (out, vector, origin, radians) => {
|
|
726
726
|
const p = [];
|
|
727
727
|
const r = [];
|
|
728
728
|
p[0] = vector[0] - origin[0];
|
|
@@ -736,7 +736,7 @@ var require_rotateX = __commonJS({
|
|
|
736
736
|
out[2] = r[2] + origin[2];
|
|
737
737
|
return out;
|
|
738
738
|
};
|
|
739
|
-
module.exports =
|
|
739
|
+
module.exports = rotateX4;
|
|
740
740
|
}
|
|
741
741
|
});
|
|
742
742
|
|
|
@@ -842,13 +842,13 @@ var require_squaredLength = __commonJS({
|
|
|
842
842
|
var require_subtract = __commonJS({
|
|
843
843
|
"node_modules/@jscad/modeling/src/maths/vec3/subtract.js"(exports, module) {
|
|
844
844
|
"use strict";
|
|
845
|
-
var
|
|
845
|
+
var subtract3 = (out, a, b) => {
|
|
846
846
|
out[0] = a[0] - b[0];
|
|
847
847
|
out[1] = a[1] - b[1];
|
|
848
848
|
out[2] = a[2] - b[2];
|
|
849
849
|
return out;
|
|
850
850
|
};
|
|
851
|
-
module.exports =
|
|
851
|
+
module.exports = subtract3;
|
|
852
852
|
}
|
|
853
853
|
});
|
|
854
854
|
|
|
@@ -1240,7 +1240,7 @@ var require_rotateX2 = __commonJS({
|
|
|
1240
1240
|
"node_modules/@jscad/modeling/src/maths/mat4/rotateX.js"(exports, module) {
|
|
1241
1241
|
"use strict";
|
|
1242
1242
|
var { sin, cos } = require_trigonometry();
|
|
1243
|
-
var
|
|
1243
|
+
var rotateX4 = (out, matrix, radians) => {
|
|
1244
1244
|
const s = sin(radians);
|
|
1245
1245
|
const c = cos(radians);
|
|
1246
1246
|
const a10 = matrix[4];
|
|
@@ -1271,7 +1271,7 @@ var require_rotateX2 = __commonJS({
|
|
|
1271
1271
|
out[11] = a23 * c - a13 * s;
|
|
1272
1272
|
return out;
|
|
1273
1273
|
};
|
|
1274
|
-
module.exports =
|
|
1274
|
+
module.exports = rotateX4;
|
|
1275
1275
|
}
|
|
1276
1276
|
});
|
|
1277
1277
|
|
|
@@ -1389,7 +1389,7 @@ var require_scale2 = __commonJS({
|
|
|
1389
1389
|
var require_subtract2 = __commonJS({
|
|
1390
1390
|
"node_modules/@jscad/modeling/src/maths/mat4/subtract.js"(exports, module) {
|
|
1391
1391
|
"use strict";
|
|
1392
|
-
var
|
|
1392
|
+
var subtract3 = (out, a, b) => {
|
|
1393
1393
|
out[0] = a[0] - b[0];
|
|
1394
1394
|
out[1] = a[1] - b[1];
|
|
1395
1395
|
out[2] = a[2] - b[2];
|
|
@@ -1408,7 +1408,7 @@ var require_subtract2 = __commonJS({
|
|
|
1408
1408
|
out[15] = a[15] - b[15];
|
|
1409
1409
|
return out;
|
|
1410
1410
|
};
|
|
1411
|
-
module.exports =
|
|
1411
|
+
module.exports = subtract3;
|
|
1412
1412
|
}
|
|
1413
1413
|
});
|
|
1414
1414
|
|
|
@@ -1927,12 +1927,12 @@ var require_squaredLength2 = __commonJS({
|
|
|
1927
1927
|
var require_subtract3 = __commonJS({
|
|
1928
1928
|
"node_modules/@jscad/modeling/src/maths/vec2/subtract.js"(exports, module) {
|
|
1929
1929
|
"use strict";
|
|
1930
|
-
var
|
|
1930
|
+
var subtract3 = (out, a, b) => {
|
|
1931
1931
|
out[0] = a[0] - b[0];
|
|
1932
1932
|
out[1] = a[1] - b[1];
|
|
1933
1933
|
return out;
|
|
1934
1934
|
};
|
|
1935
|
-
module.exports =
|
|
1935
|
+
module.exports = subtract3;
|
|
1936
1936
|
}
|
|
1937
1937
|
});
|
|
1938
1938
|
|
|
@@ -2393,14 +2393,14 @@ var require_point_line_distance = __commonJS({
|
|
|
2393
2393
|
"node_modules/@jscad/modeling/src/operations/hulls/quickhull/point-line-distance.js"(exports, module) {
|
|
2394
2394
|
"use strict";
|
|
2395
2395
|
var cross = require_cross();
|
|
2396
|
-
var
|
|
2396
|
+
var subtract3 = require_subtract();
|
|
2397
2397
|
var squaredLength = require_squaredLength();
|
|
2398
2398
|
var distanceSquared = (p, a, b) => {
|
|
2399
2399
|
const ab = [];
|
|
2400
2400
|
const ap = [];
|
|
2401
2401
|
const cr = [];
|
|
2402
|
-
|
|
2403
|
-
|
|
2402
|
+
subtract3(ab, b, a);
|
|
2403
|
+
subtract3(ap, p, a);
|
|
2404
2404
|
const area = squaredLength(cross(cr, ap, ab));
|
|
2405
2405
|
const s = squaredLength(ab);
|
|
2406
2406
|
if (s === 0) {
|
|
@@ -2419,11 +2419,11 @@ var require_get_plane_normal = __commonJS({
|
|
|
2419
2419
|
"use strict";
|
|
2420
2420
|
var cross = require_cross();
|
|
2421
2421
|
var normalize = require_normalize();
|
|
2422
|
-
var
|
|
2422
|
+
var subtract3 = require_subtract();
|
|
2423
2423
|
var planeNormal = (out, point1, point2, point3) => {
|
|
2424
2424
|
const tmp = [0, 0, 0];
|
|
2425
|
-
|
|
2426
|
-
|
|
2425
|
+
subtract3(out, point1, point2);
|
|
2426
|
+
subtract3(tmp, point2, point3);
|
|
2427
2427
|
cross(out, out, tmp);
|
|
2428
2428
|
return normalize(out, out);
|
|
2429
2429
|
};
|
|
@@ -2637,7 +2637,7 @@ var require_Face = __commonJS({
|
|
|
2637
2637
|
var length = require_length();
|
|
2638
2638
|
var normalize = require_normalize();
|
|
2639
2639
|
var scale = require_scale();
|
|
2640
|
-
var
|
|
2640
|
+
var subtract3 = require_subtract();
|
|
2641
2641
|
var HalfEdge = require_HalfEdge();
|
|
2642
2642
|
var VISIBLE = 0;
|
|
2643
2643
|
var NON_CONVEX = 1;
|
|
@@ -2671,14 +2671,14 @@ var require_Face = __commonJS({
|
|
|
2671
2671
|
const e0 = this.edge;
|
|
2672
2672
|
const e1 = e0.next;
|
|
2673
2673
|
let e2 = e1.next;
|
|
2674
|
-
const v2 =
|
|
2674
|
+
const v2 = subtract3([], e1.head().point, e0.head().point);
|
|
2675
2675
|
const t = [];
|
|
2676
2676
|
const v1 = [];
|
|
2677
2677
|
this.nVertices = 2;
|
|
2678
2678
|
this.normal = [0, 0, 0];
|
|
2679
2679
|
while (e2 !== e0) {
|
|
2680
2680
|
copy(v1, v2);
|
|
2681
|
-
|
|
2681
|
+
subtract3(v2, e2.head().point, e0.head().point);
|
|
2682
2682
|
add(this.normal, this.normal, cross(t, v1, v2));
|
|
2683
2683
|
e2 = e2.next;
|
|
2684
2684
|
this.nVertices += 1;
|
|
@@ -2702,7 +2702,7 @@ var require_Face = __commonJS({
|
|
|
2702
2702
|
} while (edge !== this.edge);
|
|
2703
2703
|
const p1 = maxEdge.tail().point;
|
|
2704
2704
|
const p2 = maxEdge.head().point;
|
|
2705
|
-
const maxVector =
|
|
2705
|
+
const maxVector = subtract3([], p2, p1);
|
|
2706
2706
|
const maxLength = Math.sqrt(maxSquaredLength);
|
|
2707
2707
|
scale(maxVector, maxVector, 1 / maxLength);
|
|
2708
2708
|
const maxProjection = dot(this.normal, maxVector);
|
|
@@ -3976,7 +3976,7 @@ var require_measureBoundingBox = __commonJS({
|
|
|
3976
3976
|
"node_modules/@jscad/modeling/src/geometries/poly3/measureBoundingBox.js"(exports, module) {
|
|
3977
3977
|
"use strict";
|
|
3978
3978
|
var vec3 = require_vec3();
|
|
3979
|
-
var
|
|
3979
|
+
var measureBoundingBox4 = (polygon4) => {
|
|
3980
3980
|
const vertices = polygon4.vertices;
|
|
3981
3981
|
const numvertices = vertices.length;
|
|
3982
3982
|
const min = numvertices === 0 ? vec3.create() : vec3.clone(vertices[0]);
|
|
@@ -3987,7 +3987,7 @@ var require_measureBoundingBox = __commonJS({
|
|
|
3987
3987
|
}
|
|
3988
3988
|
return [min, max];
|
|
3989
3989
|
};
|
|
3990
|
-
module.exports =
|
|
3990
|
+
module.exports = measureBoundingBox4;
|
|
3991
3991
|
}
|
|
3992
3992
|
});
|
|
3993
3993
|
|
|
@@ -4330,8 +4330,8 @@ var require_toPolygons = __commonJS({
|
|
|
4330
4330
|
"node_modules/@jscad/modeling/src/geometries/geom3/toPolygons.js"(exports, module) {
|
|
4331
4331
|
"use strict";
|
|
4332
4332
|
var applyTransforms = require_applyTransforms2();
|
|
4333
|
-
var
|
|
4334
|
-
module.exports =
|
|
4333
|
+
var toPolygons3 = (geometry) => applyTransforms(geometry).polygons;
|
|
4334
|
+
module.exports = toPolygons3;
|
|
4335
4335
|
}
|
|
4336
4336
|
});
|
|
4337
4337
|
|
|
@@ -4341,9 +4341,9 @@ var require_invert3 = __commonJS({
|
|
|
4341
4341
|
"use strict";
|
|
4342
4342
|
var poly3 = require_poly3();
|
|
4343
4343
|
var create = require_create5();
|
|
4344
|
-
var
|
|
4344
|
+
var toPolygons3 = require_toPolygons();
|
|
4345
4345
|
var invert = (geometry) => {
|
|
4346
|
-
const polygons =
|
|
4346
|
+
const polygons = toPolygons3(geometry);
|
|
4347
4347
|
const newpolygons = polygons.map((polygon4) => poly3.invert(polygon4));
|
|
4348
4348
|
return create(newpolygons);
|
|
4349
4349
|
};
|
|
@@ -4374,9 +4374,9 @@ var require_toPoints3 = __commonJS({
|
|
|
4374
4374
|
"node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js"(exports, module) {
|
|
4375
4375
|
"use strict";
|
|
4376
4376
|
var poly3 = require_poly3();
|
|
4377
|
-
var
|
|
4377
|
+
var toPolygons3 = require_toPolygons();
|
|
4378
4378
|
var toPoints = (geometry) => {
|
|
4379
|
-
const polygons =
|
|
4379
|
+
const polygons = toPolygons3(geometry);
|
|
4380
4380
|
const listofpoints = polygons.map((polygon4) => poly3.toPoints(polygon4));
|
|
4381
4381
|
return listofpoints;
|
|
4382
4382
|
};
|
|
@@ -4389,9 +4389,9 @@ var require_toString7 = __commonJS({
|
|
|
4389
4389
|
"node_modules/@jscad/modeling/src/geometries/geom3/toString.js"(exports, module) {
|
|
4390
4390
|
"use strict";
|
|
4391
4391
|
var poly3 = require_poly3();
|
|
4392
|
-
var
|
|
4392
|
+
var toPolygons3 = require_toPolygons();
|
|
4393
4393
|
var toString = (geometry) => {
|
|
4394
|
-
const polygons =
|
|
4394
|
+
const polygons = toPolygons3(geometry);
|
|
4395
4395
|
let result = "geom3 (" + polygons.length + " polygons):\n";
|
|
4396
4396
|
polygons.forEach((polygon4) => {
|
|
4397
4397
|
result += " " + poly3.toString(polygon4) + "\n";
|
|
@@ -5510,7 +5510,7 @@ var require_toPolygons2 = __commonJS({
|
|
|
5510
5510
|
var poly3 = require_poly3();
|
|
5511
5511
|
var earcut = require_earcut();
|
|
5512
5512
|
var PolygonHierarchy = require_polygonHierarchy();
|
|
5513
|
-
var
|
|
5513
|
+
var toPolygons3 = (slice) => {
|
|
5514
5514
|
const hierarchy = new PolygonHierarchy(slice);
|
|
5515
5515
|
const polygons = [];
|
|
5516
5516
|
hierarchy.roots.forEach(({ solid, holes }) => {
|
|
@@ -5531,7 +5531,7 @@ var require_toPolygons2 = __commonJS({
|
|
|
5531
5531
|
});
|
|
5532
5532
|
return polygons;
|
|
5533
5533
|
};
|
|
5534
|
-
module.exports =
|
|
5534
|
+
module.exports = toPolygons3;
|
|
5535
5535
|
}
|
|
5536
5536
|
});
|
|
5537
5537
|
|
|
@@ -5706,7 +5706,7 @@ var require_extrudeFromSlices = __commonJS({
|
|
|
5706
5706
|
"use strict";
|
|
5707
5707
|
var mat4 = require_mat4();
|
|
5708
5708
|
var geom2 = require_geom2();
|
|
5709
|
-
var
|
|
5709
|
+
var geom34 = require_geom3();
|
|
5710
5710
|
var poly3 = require_poly3();
|
|
5711
5711
|
var slice = require_slice();
|
|
5712
5712
|
var repairSlice = require_repair();
|
|
@@ -5763,7 +5763,7 @@ var require_extrudeFromSlices = __commonJS({
|
|
|
5763
5763
|
polygons = polygons.concat(extrudeWalls(endSlice, startSlice));
|
|
5764
5764
|
}
|
|
5765
5765
|
}
|
|
5766
|
-
return
|
|
5766
|
+
return geom34.create(polygons);
|
|
5767
5767
|
};
|
|
5768
5768
|
module.exports = extrudeFromSlices;
|
|
5769
5769
|
}
|
|
@@ -6867,14 +6867,14 @@ var require_areAllShapesTheSameType = __commonJS({
|
|
|
6867
6867
|
"node_modules/@jscad/modeling/src/utils/areAllShapesTheSameType.js"(exports, module) {
|
|
6868
6868
|
"use strict";
|
|
6869
6869
|
var geom2 = require_geom2();
|
|
6870
|
-
var
|
|
6870
|
+
var geom34 = require_geom3();
|
|
6871
6871
|
var path2 = require_path2();
|
|
6872
6872
|
var areAllShapesTheSameType = (shapes) => {
|
|
6873
6873
|
let previousType;
|
|
6874
6874
|
for (const shape of shapes) {
|
|
6875
6875
|
let currentType = 0;
|
|
6876
6876
|
if (geom2.isA(shape)) currentType = 1;
|
|
6877
|
-
if (
|
|
6877
|
+
if (geom34.isA(shape)) currentType = 2;
|
|
6878
6878
|
if (path2.isA(shape)) currentType = 3;
|
|
6879
6879
|
if (previousType && currentType !== previousType) return false;
|
|
6880
6880
|
previousType = currentType;
|
|
@@ -6923,7 +6923,7 @@ var require_measureBoundingBox2 = __commonJS({
|
|
|
6923
6923
|
var vec2 = require_vec2();
|
|
6924
6924
|
var vec3 = require_vec3();
|
|
6925
6925
|
var geom2 = require_geom2();
|
|
6926
|
-
var
|
|
6926
|
+
var geom34 = require_geom3();
|
|
6927
6927
|
var path2 = require_path2();
|
|
6928
6928
|
var poly3 = require_poly3();
|
|
6929
6929
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -6972,7 +6972,7 @@ var require_measureBoundingBox2 = __commonJS({
|
|
|
6972
6972
|
var measureBoundingBoxOfGeom3 = (geometry) => {
|
|
6973
6973
|
let boundingBox = cache.get(geometry);
|
|
6974
6974
|
if (boundingBox) return boundingBox;
|
|
6975
|
-
const polygons =
|
|
6975
|
+
const polygons = geom34.toPolygons(geometry);
|
|
6976
6976
|
let minpoint = vec3.create();
|
|
6977
6977
|
if (polygons.length > 0) {
|
|
6978
6978
|
const points = poly3.toPoints(polygons[0]);
|
|
@@ -6991,18 +6991,18 @@ var require_measureBoundingBox2 = __commonJS({
|
|
|
6991
6991
|
cache.set(geometry, boundingBox);
|
|
6992
6992
|
return boundingBox;
|
|
6993
6993
|
};
|
|
6994
|
-
var
|
|
6994
|
+
var measureBoundingBox4 = (...geometries) => {
|
|
6995
6995
|
geometries = flatten(geometries);
|
|
6996
6996
|
if (geometries.length === 0) throw new Error("wrong number of arguments");
|
|
6997
6997
|
const results = geometries.map((geometry) => {
|
|
6998
6998
|
if (path2.isA(geometry)) return measureBoundingBoxOfPath2(geometry);
|
|
6999
6999
|
if (geom2.isA(geometry)) return measureBoundingBoxOfGeom2(geometry);
|
|
7000
|
-
if (
|
|
7000
|
+
if (geom34.isA(geometry)) return measureBoundingBoxOfGeom3(geometry);
|
|
7001
7001
|
return [[0, 0, 0], [0, 0, 0]];
|
|
7002
7002
|
});
|
|
7003
7003
|
return results.length === 1 ? results[0] : results;
|
|
7004
7004
|
};
|
|
7005
|
-
module.exports =
|
|
7005
|
+
module.exports = measureBoundingBox4;
|
|
7006
7006
|
}
|
|
7007
7007
|
});
|
|
7008
7008
|
|
|
@@ -7011,19 +7011,19 @@ var require_measureEpsilon = __commonJS({
|
|
|
7011
7011
|
"node_modules/@jscad/modeling/src/measurements/measureEpsilon.js"(exports, module) {
|
|
7012
7012
|
"use strict";
|
|
7013
7013
|
var flatten = require_flatten();
|
|
7014
|
-
var { geom2, geom3:
|
|
7014
|
+
var { geom2, geom3: geom34, path2 } = require_geometries();
|
|
7015
7015
|
var calculateEpsilonFromBounds = require_calculateEpsilonFromBounds();
|
|
7016
|
-
var
|
|
7017
|
-
var measureEpsilonOfPath2 = (geometry) => calculateEpsilonFromBounds(
|
|
7018
|
-
var measureEpsilonOfGeom2 = (geometry) => calculateEpsilonFromBounds(
|
|
7019
|
-
var measureEpsilonOfGeom3 = (geometry) => calculateEpsilonFromBounds(
|
|
7016
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
7017
|
+
var measureEpsilonOfPath2 = (geometry) => calculateEpsilonFromBounds(measureBoundingBox4(geometry), 2);
|
|
7018
|
+
var measureEpsilonOfGeom2 = (geometry) => calculateEpsilonFromBounds(measureBoundingBox4(geometry), 2);
|
|
7019
|
+
var measureEpsilonOfGeom3 = (geometry) => calculateEpsilonFromBounds(measureBoundingBox4(geometry), 3);
|
|
7020
7020
|
var measureEpsilon = (...geometries) => {
|
|
7021
7021
|
geometries = flatten(geometries);
|
|
7022
7022
|
if (geometries.length === 0) throw new Error("wrong number of arguments");
|
|
7023
7023
|
const results = geometries.map((geometry) => {
|
|
7024
7024
|
if (path2.isA(geometry)) return measureEpsilonOfPath2(geometry);
|
|
7025
7025
|
if (geom2.isA(geometry)) return measureEpsilonOfGeom2(geometry);
|
|
7026
|
-
if (
|
|
7026
|
+
if (geom34.isA(geometry)) return measureEpsilonOfGeom3(geometry);
|
|
7027
7027
|
return 0;
|
|
7028
7028
|
});
|
|
7029
7029
|
return results.length === 1 ? results[0] : results;
|
|
@@ -7083,7 +7083,7 @@ var require_to3DWalls = __commonJS({
|
|
|
7083
7083
|
"use strict";
|
|
7084
7084
|
var vec3 = require_vec3();
|
|
7085
7085
|
var geom2 = require_geom2();
|
|
7086
|
-
var
|
|
7086
|
+
var geom34 = require_geom3();
|
|
7087
7087
|
var poly3 = require_poly3();
|
|
7088
7088
|
var to3DWall = (z0, z1, side) => {
|
|
7089
7089
|
const points = [
|
|
@@ -7097,7 +7097,7 @@ var require_to3DWalls = __commonJS({
|
|
|
7097
7097
|
var to3DWalls = (options, geometry) => {
|
|
7098
7098
|
const sides = geom2.toSides(geometry);
|
|
7099
7099
|
const polygons = sides.map((side) => to3DWall(options.z0, options.z1, side));
|
|
7100
|
-
const result =
|
|
7100
|
+
const result = geom34.create(polygons);
|
|
7101
7101
|
return result;
|
|
7102
7102
|
};
|
|
7103
7103
|
module.exports = to3DWalls;
|
|
@@ -7544,7 +7544,7 @@ var require_reTesselateCoplanarPolygons = __commonJS({
|
|
|
7544
7544
|
var require_retessellate = __commonJS({
|
|
7545
7545
|
"node_modules/@jscad/modeling/src/operations/modifiers/retessellate.js"(exports, module) {
|
|
7546
7546
|
"use strict";
|
|
7547
|
-
var
|
|
7547
|
+
var geom34 = require_geom3();
|
|
7548
7548
|
var poly3 = require_poly3();
|
|
7549
7549
|
var { NEPS } = require_constants();
|
|
7550
7550
|
var reTesselateCoplanarPolygons = require_reTesselateCoplanarPolygons();
|
|
@@ -7552,7 +7552,7 @@ var require_retessellate = __commonJS({
|
|
|
7552
7552
|
if (geometry.isRetesselated) {
|
|
7553
7553
|
return geometry;
|
|
7554
7554
|
}
|
|
7555
|
-
const polygons =
|
|
7555
|
+
const polygons = geom34.toPolygons(geometry).map((polygon4, index) => ({ vertices: polygon4.vertices, plane: poly3.plane(polygon4), index }));
|
|
7556
7556
|
const classified = classifyPolygons(polygons);
|
|
7557
7557
|
const destPolygons = [];
|
|
7558
7558
|
classified.forEach((group) => {
|
|
@@ -7563,7 +7563,7 @@ var require_retessellate = __commonJS({
|
|
|
7563
7563
|
destPolygons.push(group);
|
|
7564
7564
|
}
|
|
7565
7565
|
});
|
|
7566
|
-
const result =
|
|
7566
|
+
const result = geom34.create(destPolygons);
|
|
7567
7567
|
result.isRetesselated = true;
|
|
7568
7568
|
return result;
|
|
7569
7569
|
};
|
|
@@ -7620,15 +7620,15 @@ var require_mayOverlap = __commonJS({
|
|
|
7620
7620
|
"node_modules/@jscad/modeling/src/operations/booleans/mayOverlap.js"(exports, module) {
|
|
7621
7621
|
"use strict";
|
|
7622
7622
|
var { EPS } = require_constants();
|
|
7623
|
-
var
|
|
7623
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
7624
7624
|
var mayOverlap = (geometry1, geometry2) => {
|
|
7625
7625
|
if (geometry1.polygons.length === 0 || geometry2.polygons.length === 0) {
|
|
7626
7626
|
return false;
|
|
7627
7627
|
}
|
|
7628
|
-
const bounds1 =
|
|
7628
|
+
const bounds1 = measureBoundingBox4(geometry1);
|
|
7629
7629
|
const min1 = bounds1[0];
|
|
7630
7630
|
const max1 = bounds1[1];
|
|
7631
|
-
const bounds2 =
|
|
7631
|
+
const bounds2 = measureBoundingBox4(geometry2);
|
|
7632
7632
|
const min2 = bounds2[0];
|
|
7633
7633
|
const max2 = bounds2[1];
|
|
7634
7634
|
if (min2[0] - max1[0] > EPS) return false;
|
|
@@ -8169,28 +8169,28 @@ var require_trees = __commonJS({
|
|
|
8169
8169
|
var require_unionGeom3Sub = __commonJS({
|
|
8170
8170
|
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
|
|
8171
8171
|
"use strict";
|
|
8172
|
-
var
|
|
8172
|
+
var geom34 = require_geom3();
|
|
8173
8173
|
var mayOverlap = require_mayOverlap();
|
|
8174
8174
|
var { Tree } = require_trees();
|
|
8175
8175
|
var unionSub = (geometry1, geometry2) => {
|
|
8176
8176
|
if (!mayOverlap(geometry1, geometry2)) {
|
|
8177
8177
|
return unionForNonIntersecting(geometry1, geometry2);
|
|
8178
8178
|
}
|
|
8179
|
-
const a = new Tree(
|
|
8180
|
-
const b = new Tree(
|
|
8179
|
+
const a = new Tree(geom34.toPolygons(geometry1));
|
|
8180
|
+
const b = new Tree(geom34.toPolygons(geometry2));
|
|
8181
8181
|
a.clipTo(b, false);
|
|
8182
8182
|
b.clipTo(a);
|
|
8183
8183
|
b.invert();
|
|
8184
8184
|
b.clipTo(a);
|
|
8185
8185
|
b.invert();
|
|
8186
8186
|
const newpolygons = a.allPolygons().concat(b.allPolygons());
|
|
8187
|
-
const result =
|
|
8187
|
+
const result = geom34.create(newpolygons);
|
|
8188
8188
|
return result;
|
|
8189
8189
|
};
|
|
8190
8190
|
var unionForNonIntersecting = (geometry1, geometry2) => {
|
|
8191
|
-
let newpolygons =
|
|
8192
|
-
newpolygons = newpolygons.concat(
|
|
8193
|
-
return
|
|
8191
|
+
let newpolygons = geom34.toPolygons(geometry1);
|
|
8192
|
+
newpolygons = newpolygons.concat(geom34.toPolygons(geometry2));
|
|
8193
|
+
return geom34.create(newpolygons);
|
|
8194
8194
|
};
|
|
8195
8195
|
module.exports = unionSub;
|
|
8196
8196
|
}
|
|
@@ -8222,7 +8222,7 @@ var require_unionGeom2 = __commonJS({
|
|
|
8222
8222
|
"node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(exports, module) {
|
|
8223
8223
|
"use strict";
|
|
8224
8224
|
var flatten = require_flatten();
|
|
8225
|
-
var
|
|
8225
|
+
var geom34 = require_geom3();
|
|
8226
8226
|
var measureEpsilon = require_measureEpsilon();
|
|
8227
8227
|
var fromFakePolygons = require_fromFakePolygons();
|
|
8228
8228
|
var to3DWalls = require_to3DWalls();
|
|
@@ -8232,7 +8232,7 @@ var require_unionGeom2 = __commonJS({
|
|
|
8232
8232
|
const newgeometries = geometries.map((geometry) => to3DWalls({ z0: -1, z1: 1 }, geometry));
|
|
8233
8233
|
const newgeom3 = unionGeom3(newgeometries);
|
|
8234
8234
|
const epsilon = measureEpsilon(newgeom3);
|
|
8235
|
-
return fromFakePolygons(epsilon,
|
|
8235
|
+
return fromFakePolygons(epsilon, geom34.toPolygons(newgeom3));
|
|
8236
8236
|
};
|
|
8237
8237
|
module.exports = union;
|
|
8238
8238
|
}
|
|
@@ -8245,7 +8245,7 @@ var require_union = __commonJS({
|
|
|
8245
8245
|
var flatten = require_flatten();
|
|
8246
8246
|
var areAllShapesTheSameType = require_areAllShapesTheSameType();
|
|
8247
8247
|
var geom2 = require_geom2();
|
|
8248
|
-
var
|
|
8248
|
+
var geom34 = require_geom3();
|
|
8249
8249
|
var unionGeom2 = require_unionGeom2();
|
|
8250
8250
|
var unionGeom3 = require_unionGeom3();
|
|
8251
8251
|
var union = (...geometries) => {
|
|
@@ -8256,7 +8256,7 @@ var require_union = __commonJS({
|
|
|
8256
8256
|
}
|
|
8257
8257
|
const geometry = geometries[0];
|
|
8258
8258
|
if (geom2.isA(geometry)) return unionGeom2(geometries);
|
|
8259
|
-
if (
|
|
8259
|
+
if (geom34.isA(geometry)) return unionGeom3(geometries);
|
|
8260
8260
|
return geometry;
|
|
8261
8261
|
};
|
|
8262
8262
|
module.exports = union;
|
|
@@ -8289,7 +8289,7 @@ var require_ellipsoid = __commonJS({
|
|
|
8289
8289
|
"use strict";
|
|
8290
8290
|
var { TAU } = require_constants();
|
|
8291
8291
|
var vec3 = require_vec3();
|
|
8292
|
-
var
|
|
8292
|
+
var geom34 = require_geom3();
|
|
8293
8293
|
var poly3 = require_poly3();
|
|
8294
8294
|
var { sin, cos } = require_trigonometry();
|
|
8295
8295
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
@@ -8305,7 +8305,7 @@ var require_ellipsoid = __commonJS({
|
|
|
8305
8305
|
if (!isNumberArray(radius, 3)) throw new Error("radius must be an array of X, Y and Z values");
|
|
8306
8306
|
if (!radius.every((n) => n >= 0)) throw new Error("radius values must be positive");
|
|
8307
8307
|
if (!isGTE(segments, 4)) throw new Error("segments must be four or more");
|
|
8308
|
-
if (radius[0] === 0 || radius[1] === 0 || radius[2] === 0) return
|
|
8308
|
+
if (radius[0] === 0 || radius[1] === 0 || radius[2] === 0) return geom34.create();
|
|
8309
8309
|
const xvector = vec3.scale(vec3.create(), vec3.normalize(vec3.create(), axes[0]), radius[0]);
|
|
8310
8310
|
const yvector = vec3.scale(vec3.create(), vec3.normalize(vec3.create(), axes[1]), radius[1]);
|
|
8311
8311
|
const zvector = vec3.scale(vec3.create(), vec3.normalize(vec3.create(), axes[2]), radius[2]);
|
|
@@ -8357,7 +8357,7 @@ var require_ellipsoid = __commonJS({
|
|
|
8357
8357
|
}
|
|
8358
8358
|
prevcylinderpoint = cylinderpoint;
|
|
8359
8359
|
}
|
|
8360
|
-
return
|
|
8360
|
+
return geom34.create(polygons);
|
|
8361
8361
|
};
|
|
8362
8362
|
module.exports = ellipsoid;
|
|
8363
8363
|
}
|
|
@@ -8391,7 +8391,7 @@ var require_extrudePolygon = __commonJS({
|
|
|
8391
8391
|
"use strict";
|
|
8392
8392
|
var mat4 = require_mat4();
|
|
8393
8393
|
var vec3 = require_vec3();
|
|
8394
|
-
var
|
|
8394
|
+
var geom34 = require_geom3();
|
|
8395
8395
|
var poly3 = require_poly3();
|
|
8396
8396
|
var extrudePolygon = (offsetvector, polygon1) => {
|
|
8397
8397
|
const direction = vec3.dot(poly3.plane(polygon1), offsetvector);
|
|
@@ -8412,7 +8412,7 @@ var require_extrudePolygon = __commonJS({
|
|
|
8412
8412
|
newpolygons.push(sideFacePolygon);
|
|
8413
8413
|
}
|
|
8414
8414
|
newpolygons.push(poly3.invert(polygon22));
|
|
8415
|
-
return
|
|
8415
|
+
return geom34.create(newpolygons);
|
|
8416
8416
|
};
|
|
8417
8417
|
module.exports = extrudePolygon;
|
|
8418
8418
|
}
|
|
@@ -8426,7 +8426,7 @@ var require_expandShell = __commonJS({
|
|
|
8426
8426
|
var mat4 = require_mat4();
|
|
8427
8427
|
var vec3 = require_vec3();
|
|
8428
8428
|
var fnNumberSort = require_fnNumberSort();
|
|
8429
|
-
var
|
|
8429
|
+
var geom34 = require_geom3();
|
|
8430
8430
|
var poly3 = require_poly3();
|
|
8431
8431
|
var sphere = require_sphere();
|
|
8432
8432
|
var retessellate = require_retessellate();
|
|
@@ -8466,12 +8466,12 @@ var require_expandShell = __commonJS({
|
|
|
8466
8466
|
segments: 12
|
|
8467
8467
|
};
|
|
8468
8468
|
const { delta, segments } = Object.assign({}, defaults, options);
|
|
8469
|
-
let result =
|
|
8469
|
+
let result = geom34.create();
|
|
8470
8470
|
const vertices2planes = /* @__PURE__ */ new Map();
|
|
8471
8471
|
const edges2planes = /* @__PURE__ */ new Map();
|
|
8472
8472
|
const v1 = vec3.create();
|
|
8473
8473
|
const v2 = vec3.create();
|
|
8474
|
-
const polygons =
|
|
8474
|
+
const polygons = geom34.toPolygons(geometry);
|
|
8475
8475
|
polygons.forEach((polygon4, index) => {
|
|
8476
8476
|
const extrudevector = vec3.scale(vec3.create(), poly3.plane(polygon4), 2 * delta);
|
|
8477
8477
|
const translatedpolygon = poly3.transform(mat4.fromTranslation(mat4.create(), vec3.scale(vec3.create(), extrudevector, -0.5)), polygon4);
|
|
@@ -8546,7 +8546,7 @@ var require_expandShell = __commonJS({
|
|
|
8546
8546
|
endfacevertices.reverse();
|
|
8547
8547
|
polygons2.push(poly3.create(startfacevertices));
|
|
8548
8548
|
polygons2.push(poly3.create(endfacevertices));
|
|
8549
|
-
const cylinder2 =
|
|
8549
|
+
const cylinder2 = geom34.create(polygons2);
|
|
8550
8550
|
result = unionGeom3Sub(result, cylinder2);
|
|
8551
8551
|
});
|
|
8552
8552
|
vertices2planes.forEach((item) => {
|
|
@@ -8590,7 +8590,7 @@ var require_expandShell = __commonJS({
|
|
|
8590
8590
|
var require_expandGeom3 = __commonJS({
|
|
8591
8591
|
"node_modules/@jscad/modeling/src/operations/expansions/expandGeom3.js"(exports, module) {
|
|
8592
8592
|
"use strict";
|
|
8593
|
-
var
|
|
8593
|
+
var geom34 = require_geom3();
|
|
8594
8594
|
var union = require_union();
|
|
8595
8595
|
var expandShell = require_expandShell();
|
|
8596
8596
|
var expandGeom3 = (options, geometry) => {
|
|
@@ -8603,7 +8603,7 @@ var require_expandGeom3 = __commonJS({
|
|
|
8603
8603
|
if (!(corners === "round")) {
|
|
8604
8604
|
throw new Error('corners must be "round" for 3D geometries');
|
|
8605
8605
|
}
|
|
8606
|
-
const polygons =
|
|
8606
|
+
const polygons = geom34.toPolygons(geometry);
|
|
8607
8607
|
if (polygons.length === 0) throw new Error("the given geometry cannot be empty");
|
|
8608
8608
|
options = { delta, corners, segments };
|
|
8609
8609
|
const expanded = expandShell(options, geometry);
|
|
@@ -8700,7 +8700,7 @@ var require_expand = __commonJS({
|
|
|
8700
8700
|
"use strict";
|
|
8701
8701
|
var flatten = require_flatten();
|
|
8702
8702
|
var geom2 = require_geom2();
|
|
8703
|
-
var
|
|
8703
|
+
var geom34 = require_geom3();
|
|
8704
8704
|
var path2 = require_path2();
|
|
8705
8705
|
var expandGeom2 = require_expandGeom2();
|
|
8706
8706
|
var expandGeom3 = require_expandGeom3();
|
|
@@ -8711,7 +8711,7 @@ var require_expand = __commonJS({
|
|
|
8711
8711
|
const results = objects.map((object) => {
|
|
8712
8712
|
if (path2.isA(object)) return expandPath2(options, object);
|
|
8713
8713
|
if (geom2.isA(object)) return expandGeom2(options, object);
|
|
8714
|
-
if (
|
|
8714
|
+
if (geom34.isA(object)) return expandGeom3(options, object);
|
|
8715
8715
|
return object;
|
|
8716
8716
|
});
|
|
8717
8717
|
return results.length === 1 ? results[0] : results;
|
|
@@ -8813,7 +8813,7 @@ var require_mirror = __commonJS({
|
|
|
8813
8813
|
var mat4 = require_mat4();
|
|
8814
8814
|
var plane = require_plane();
|
|
8815
8815
|
var geom2 = require_geom2();
|
|
8816
|
-
var
|
|
8816
|
+
var geom34 = require_geom3();
|
|
8817
8817
|
var path2 = require_path2();
|
|
8818
8818
|
var mirror = (options, ...objects) => {
|
|
8819
8819
|
const defaults = {
|
|
@@ -8832,7 +8832,7 @@ var require_mirror = __commonJS({
|
|
|
8832
8832
|
const results = objects.map((object) => {
|
|
8833
8833
|
if (path2.isA(object)) return path2.transform(matrix, object);
|
|
8834
8834
|
if (geom2.isA(object)) return geom2.transform(matrix, object);
|
|
8835
|
-
if (
|
|
8835
|
+
if (geom34.isA(object)) return geom34.transform(matrix, object);
|
|
8836
8836
|
return object;
|
|
8837
8837
|
});
|
|
8838
8838
|
return results.length === 1 ? results[0] : results;
|
|
@@ -9016,7 +9016,7 @@ var require_project = __commonJS({
|
|
|
9016
9016
|
var plane = require_plane();
|
|
9017
9017
|
var mat4 = require_mat4();
|
|
9018
9018
|
var geom2 = require_geom2();
|
|
9019
|
-
var
|
|
9019
|
+
var geom34 = require_geom3();
|
|
9020
9020
|
var poly3 = require_poly3();
|
|
9021
9021
|
var measureEpsilon = require_measureEpsilon();
|
|
9022
9022
|
var unionGeom2 = require_unionGeom2();
|
|
@@ -9028,7 +9028,7 @@ var require_project = __commonJS({
|
|
|
9028
9028
|
const epsilon = measureEpsilon(geometry);
|
|
9029
9029
|
const epsilonArea = epsilon * epsilon * Math.sqrt(3) / 4;
|
|
9030
9030
|
if (epsilon === 0) return geom2.create();
|
|
9031
|
-
const polygons =
|
|
9031
|
+
const polygons = geom34.toPolygons(geometry);
|
|
9032
9032
|
let projpolys = [];
|
|
9033
9033
|
for (let i = 0; i < polygons.length; i++) {
|
|
9034
9034
|
const newpoints = polygons[i].vertices.map((v) => plane.projectionOfPoint(projplane, v));
|
|
@@ -9057,7 +9057,7 @@ var require_project = __commonJS({
|
|
|
9057
9057
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
9058
9058
|
options = { axis, origin };
|
|
9059
9059
|
const results = objects.map((object) => {
|
|
9060
|
-
if (
|
|
9060
|
+
if (geom34.isA(object)) return projectGeom3(options, object);
|
|
9061
9061
|
return object;
|
|
9062
9062
|
});
|
|
9063
9063
|
return results.length === 1 ? results[0] : results;
|
|
@@ -9231,7 +9231,7 @@ var require_circle = __commonJS({
|
|
|
9231
9231
|
var require_cuboid = __commonJS({
|
|
9232
9232
|
"node_modules/@jscad/modeling/src/primitives/cuboid.js"(exports, module) {
|
|
9233
9233
|
"use strict";
|
|
9234
|
-
var
|
|
9234
|
+
var geom34 = require_geom3();
|
|
9235
9235
|
var poly3 = require_poly3();
|
|
9236
9236
|
var { isNumberArray } = require_commonChecks();
|
|
9237
9237
|
var cuboid = (options) => {
|
|
@@ -9243,8 +9243,8 @@ var require_cuboid = __commonJS({
|
|
|
9243
9243
|
if (!isNumberArray(center, 3)) throw new Error("center must be an array of X, Y and Z values");
|
|
9244
9244
|
if (!isNumberArray(size, 3)) throw new Error("size must be an array of width, depth and height values");
|
|
9245
9245
|
if (!size.every((n) => n >= 0)) throw new Error("size values must be positive");
|
|
9246
|
-
if (size[0] === 0 || size[1] === 0 || size[2] === 0) return
|
|
9247
|
-
const result =
|
|
9246
|
+
if (size[0] === 0 || size[1] === 0 || size[2] === 0) return geom34.create();
|
|
9247
|
+
const result = geom34.create(
|
|
9248
9248
|
// adjust a basic shape to size
|
|
9249
9249
|
[
|
|
9250
9250
|
[[0, 4, 6, 2], [-1, 0, 0]],
|
|
@@ -9297,7 +9297,7 @@ var require_cylinderElliptic = __commonJS({
|
|
|
9297
9297
|
"use strict";
|
|
9298
9298
|
var { EPS, TAU } = require_constants();
|
|
9299
9299
|
var vec3 = require_vec3();
|
|
9300
|
-
var
|
|
9300
|
+
var geom34 = require_geom3();
|
|
9301
9301
|
var poly3 = require_poly3();
|
|
9302
9302
|
var { sin, cos } = require_trigonometry();
|
|
9303
9303
|
var { isGT, isGTE, isNumberArray } = require_commonChecks();
|
|
@@ -9386,7 +9386,7 @@ var require_cylinderElliptic = __commonJS({
|
|
|
9386
9386
|
polygons.push(fromPoints(start, end, point(0, 1, startRadius)));
|
|
9387
9387
|
polygons.push(fromPoints(point(0, 1, startRadius), end, point(1, 1, endRadius)));
|
|
9388
9388
|
}
|
|
9389
|
-
const result =
|
|
9389
|
+
const result = geom34.create(polygons);
|
|
9390
9390
|
return result;
|
|
9391
9391
|
};
|
|
9392
9392
|
module.exports = cylinderElliptic;
|
|
@@ -9397,7 +9397,7 @@ var require_cylinderElliptic = __commonJS({
|
|
|
9397
9397
|
var require_cylinder = __commonJS({
|
|
9398
9398
|
"node_modules/@jscad/modeling/src/primitives/cylinder.js"(exports, module) {
|
|
9399
9399
|
"use strict";
|
|
9400
|
-
var
|
|
9400
|
+
var geom34 = require_geom3();
|
|
9401
9401
|
var cylinderElliptic = require_cylinderElliptic();
|
|
9402
9402
|
var { isGTE } = require_commonChecks();
|
|
9403
9403
|
var cylinder2 = (options) => {
|
|
@@ -9409,7 +9409,7 @@ var require_cylinder = __commonJS({
|
|
|
9409
9409
|
};
|
|
9410
9410
|
const { center, height, radius, segments } = Object.assign({}, defaults, options);
|
|
9411
9411
|
if (!isGTE(radius, 0)) throw new Error("radius must be positive");
|
|
9412
|
-
if (height === 0 || radius === 0) return
|
|
9412
|
+
if (height === 0 || radius === 0) return geom34.create();
|
|
9413
9413
|
const newoptions = {
|
|
9414
9414
|
center,
|
|
9415
9415
|
height,
|
|
@@ -9427,7 +9427,7 @@ var require_cylinder = __commonJS({
|
|
|
9427
9427
|
var require_polyhedron = __commonJS({
|
|
9428
9428
|
"node_modules/@jscad/modeling/src/primitives/polyhedron.js"(exports, module) {
|
|
9429
9429
|
"use strict";
|
|
9430
|
-
var
|
|
9430
|
+
var geom34 = require_geom3();
|
|
9431
9431
|
var poly3 = require_poly3();
|
|
9432
9432
|
var { isNumberArray } = require_commonChecks();
|
|
9433
9433
|
var polyhedron = (options) => {
|
|
@@ -9470,7 +9470,7 @@ var require_polyhedron = __commonJS({
|
|
|
9470
9470
|
if (colors && colors[findex]) polygon4.color = colors[findex];
|
|
9471
9471
|
return polygon4;
|
|
9472
9472
|
});
|
|
9473
|
-
return
|
|
9473
|
+
return geom34.create(polygons);
|
|
9474
9474
|
};
|
|
9475
9475
|
module.exports = polyhedron;
|
|
9476
9476
|
}
|
|
@@ -9482,7 +9482,7 @@ var require_geodesicSphere = __commonJS({
|
|
|
9482
9482
|
"use strict";
|
|
9483
9483
|
var mat4 = require_mat4();
|
|
9484
9484
|
var vec3 = require_vec3();
|
|
9485
|
-
var
|
|
9485
|
+
var geom34 = require_geom3();
|
|
9486
9486
|
var polyhedron = require_polyhedron();
|
|
9487
9487
|
var { isGTE } = require_commonChecks();
|
|
9488
9488
|
var geodesicSphere = (options) => {
|
|
@@ -9493,7 +9493,7 @@ var require_geodesicSphere = __commonJS({
|
|
|
9493
9493
|
let { radius, frequency } = Object.assign({}, defaults, options);
|
|
9494
9494
|
if (!isGTE(radius, 0)) throw new Error("radius must be positive");
|
|
9495
9495
|
if (!isGTE(frequency, 6)) throw new Error("frequency must be six or more");
|
|
9496
|
-
if (radius === 0) return
|
|
9496
|
+
if (radius === 0) return geom34.create();
|
|
9497
9497
|
frequency = Math.floor(frequency / 6);
|
|
9498
9498
|
const ci = [
|
|
9499
9499
|
// hard-coded data of icosahedron (20 faces, all triangles)
|
|
@@ -9596,7 +9596,7 @@ var require_geodesicSphere = __commonJS({
|
|
|
9596
9596
|
offset = g.offset;
|
|
9597
9597
|
}
|
|
9598
9598
|
let geometry = polyhedron({ points, faces, orientation: "inward" });
|
|
9599
|
-
if (radius !== 1) geometry =
|
|
9599
|
+
if (radius !== 1) geometry = geom34.transform(mat4.fromScaling(mat4.create(), [radius, radius, radius]), geometry);
|
|
9600
9600
|
return geometry;
|
|
9601
9601
|
};
|
|
9602
9602
|
module.exports = geodesicSphere;
|
|
@@ -9704,7 +9704,7 @@ var require_roundedCuboid = __commonJS({
|
|
|
9704
9704
|
var { EPS, TAU } = require_constants();
|
|
9705
9705
|
var vec2 = require_vec2();
|
|
9706
9706
|
var vec3 = require_vec3();
|
|
9707
|
-
var
|
|
9707
|
+
var geom34 = require_geom3();
|
|
9708
9708
|
var poly3 = require_poly3();
|
|
9709
9709
|
var { sin, cos } = require_trigonometry();
|
|
9710
9710
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
@@ -9809,7 +9809,7 @@ var require_roundedCuboid = __commonJS({
|
|
|
9809
9809
|
if (!size.every((n) => n >= 0)) throw new Error("size values must be positive");
|
|
9810
9810
|
if (!isGTE(roundRadius, 0)) throw new Error("roundRadius must be positive");
|
|
9811
9811
|
if (!isGTE(segments, 4)) throw new Error("segments must be four or more");
|
|
9812
|
-
if (size[0] === 0 || size[1] === 0 || size[2] === 0) return
|
|
9812
|
+
if (size[0] === 0 || size[1] === 0 || size[2] === 0) return geom34.create();
|
|
9813
9813
|
if (roundRadius === 0) return cuboid({ center, size });
|
|
9814
9814
|
size = size.map((v) => v / 2);
|
|
9815
9815
|
if (roundRadius > size[0] - EPS || roundRadius > size[1] - EPS || roundRadius > size[2] - EPS) throw new Error("roundRadius must be smaller than the radius of all dimensions");
|
|
@@ -9844,7 +9844,7 @@ var require_roundedCuboid = __commonJS({
|
|
|
9844
9844
|
prevCornersPos = cornersPos;
|
|
9845
9845
|
prevCornersNeg = cornersNeg;
|
|
9846
9846
|
}
|
|
9847
|
-
return
|
|
9847
|
+
return geom34.create(polygons);
|
|
9848
9848
|
};
|
|
9849
9849
|
module.exports = roundedCuboid;
|
|
9850
9850
|
}
|
|
@@ -9856,7 +9856,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
9856
9856
|
"use strict";
|
|
9857
9857
|
var { EPS, TAU } = require_constants();
|
|
9858
9858
|
var vec3 = require_vec3();
|
|
9859
|
-
var
|
|
9859
|
+
var geom34 = require_geom3();
|
|
9860
9860
|
var poly3 = require_poly3();
|
|
9861
9861
|
var { sin, cos } = require_trigonometry();
|
|
9862
9862
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
@@ -9876,7 +9876,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
9876
9876
|
if (!isGTE(roundRadius, 0)) throw new Error("roundRadius must be positive");
|
|
9877
9877
|
if (roundRadius > radius) throw new Error("roundRadius must be smaller than the radius");
|
|
9878
9878
|
if (!isGTE(segments, 4)) throw new Error("segments must be four or more");
|
|
9879
|
-
if (height === 0 || radius === 0) return
|
|
9879
|
+
if (height === 0 || radius === 0) return geom34.create();
|
|
9880
9880
|
if (roundRadius === 0) return cylinder2({ center, height, radius });
|
|
9881
9881
|
const start = [0, 0, -(height / 2)];
|
|
9882
9882
|
const end = [0, 0, height / 2];
|
|
@@ -9956,7 +9956,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
9956
9956
|
}
|
|
9957
9957
|
prevcylinderpoint = cylinderpoint;
|
|
9958
9958
|
}
|
|
9959
|
-
const result =
|
|
9959
|
+
const result = geom34.create(polygons);
|
|
9960
9960
|
return result;
|
|
9961
9961
|
};
|
|
9962
9962
|
module.exports = roundedCylinder;
|
|
@@ -10104,7 +10104,7 @@ var require_rotate3 = __commonJS({
|
|
|
10104
10104
|
var flatten = require_flatten();
|
|
10105
10105
|
var mat4 = require_mat4();
|
|
10106
10106
|
var geom2 = require_geom2();
|
|
10107
|
-
var
|
|
10107
|
+
var geom34 = require_geom3();
|
|
10108
10108
|
var path2 = require_path2();
|
|
10109
10109
|
var rotate = (angles, ...objects) => {
|
|
10110
10110
|
if (!Array.isArray(angles)) throw new Error("angles must be an array");
|
|
@@ -10119,17 +10119,17 @@ var require_rotate3 = __commonJS({
|
|
|
10119
10119
|
const results = objects.map((object) => {
|
|
10120
10120
|
if (path2.isA(object)) return path2.transform(matrix, object);
|
|
10121
10121
|
if (geom2.isA(object)) return geom2.transform(matrix, object);
|
|
10122
|
-
if (
|
|
10122
|
+
if (geom34.isA(object)) return geom34.transform(matrix, object);
|
|
10123
10123
|
return object;
|
|
10124
10124
|
});
|
|
10125
10125
|
return results.length === 1 ? results[0] : results;
|
|
10126
10126
|
};
|
|
10127
|
-
var
|
|
10127
|
+
var rotateX4 = (angle, ...objects) => rotate([angle, 0, 0], objects);
|
|
10128
10128
|
var rotateY = (angle, ...objects) => rotate([0, angle, 0], objects);
|
|
10129
10129
|
var rotateZ3 = (angle, ...objects) => rotate([0, 0, angle], objects);
|
|
10130
10130
|
module.exports = {
|
|
10131
10131
|
rotate,
|
|
10132
|
-
rotateX:
|
|
10132
|
+
rotateX: rotateX4,
|
|
10133
10133
|
rotateY,
|
|
10134
10134
|
rotateZ: rotateZ3
|
|
10135
10135
|
};
|
|
@@ -10143,7 +10143,7 @@ var require_translate2 = __commonJS({
|
|
|
10143
10143
|
var flatten = require_flatten();
|
|
10144
10144
|
var mat4 = require_mat4();
|
|
10145
10145
|
var geom2 = require_geom2();
|
|
10146
|
-
var
|
|
10146
|
+
var geom34 = require_geom3();
|
|
10147
10147
|
var path2 = require_path2();
|
|
10148
10148
|
var translate4 = (offset, ...objects) => {
|
|
10149
10149
|
if (!Array.isArray(offset)) throw new Error("offset must be an array");
|
|
@@ -10155,7 +10155,7 @@ var require_translate2 = __commonJS({
|
|
|
10155
10155
|
const results = objects.map((object) => {
|
|
10156
10156
|
if (path2.isA(object)) return path2.transform(matrix, object);
|
|
10157
10157
|
if (geom2.isA(object)) return geom2.transform(matrix, object);
|
|
10158
|
-
if (
|
|
10158
|
+
if (geom34.isA(object)) return geom34.transform(matrix, object);
|
|
10159
10159
|
return object;
|
|
10160
10160
|
});
|
|
10161
10161
|
return results.length === 1 ? results[0] : results;
|
|
@@ -10383,11 +10383,11 @@ var require_measureAggregateBoundingBox = __commonJS({
|
|
|
10383
10383
|
var flatten = require_flatten();
|
|
10384
10384
|
var vec3min = require_min();
|
|
10385
10385
|
var vec3max = require_max();
|
|
10386
|
-
var
|
|
10386
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
10387
10387
|
var measureAggregateBoundingBox = (...geometries) => {
|
|
10388
10388
|
geometries = flatten(geometries);
|
|
10389
10389
|
if (geometries.length === 0) throw new Error("measureAggregateBoundingBox: no geometries supplied");
|
|
10390
|
-
const bounds =
|
|
10390
|
+
const bounds = measureBoundingBox4(geometries);
|
|
10391
10391
|
if (geometries.length === 1) {
|
|
10392
10392
|
return bounds;
|
|
10393
10393
|
}
|
|
@@ -10479,9 +10479,9 @@ var require_center = __commonJS({
|
|
|
10479
10479
|
"use strict";
|
|
10480
10480
|
var flatten = require_flatten();
|
|
10481
10481
|
var geom2 = require_geom2();
|
|
10482
|
-
var
|
|
10482
|
+
var geom34 = require_geom3();
|
|
10483
10483
|
var path2 = require_path2();
|
|
10484
|
-
var
|
|
10484
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
10485
10485
|
var { translate: translate4 } = require_translate2();
|
|
10486
10486
|
var centerGeometry = (options, object) => {
|
|
10487
10487
|
const defaults = {
|
|
@@ -10489,7 +10489,7 @@ var require_center = __commonJS({
|
|
|
10489
10489
|
relativeTo: [0, 0, 0]
|
|
10490
10490
|
};
|
|
10491
10491
|
const { axes, relativeTo } = Object.assign({}, defaults, options);
|
|
10492
|
-
const bounds =
|
|
10492
|
+
const bounds = measureBoundingBox4(object);
|
|
10493
10493
|
const offset = [0, 0, 0];
|
|
10494
10494
|
if (axes[0]) offset[0] = relativeTo[0] - (bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2);
|
|
10495
10495
|
if (axes[1]) offset[1] = relativeTo[1] - (bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2);
|
|
@@ -10510,7 +10510,7 @@ var require_center = __commonJS({
|
|
|
10510
10510
|
const results = objects.map((object) => {
|
|
10511
10511
|
if (path2.isA(object)) return centerGeometry(options, object);
|
|
10512
10512
|
if (geom2.isA(object)) return centerGeometry(options, object);
|
|
10513
|
-
if (
|
|
10513
|
+
if (geom34.isA(object)) return centerGeometry(options, object);
|
|
10514
10514
|
return object;
|
|
10515
10515
|
});
|
|
10516
10516
|
return results.length === 1 ? results[0] : results;
|
|
@@ -10534,7 +10534,7 @@ var require_scale4 = __commonJS({
|
|
|
10534
10534
|
var flatten = require_flatten();
|
|
10535
10535
|
var mat4 = require_mat4();
|
|
10536
10536
|
var geom2 = require_geom2();
|
|
10537
|
-
var
|
|
10537
|
+
var geom34 = require_geom3();
|
|
10538
10538
|
var path2 = require_path2();
|
|
10539
10539
|
var scale = (factors, ...objects) => {
|
|
10540
10540
|
if (!Array.isArray(factors)) throw new Error("factors must be an array");
|
|
@@ -10547,7 +10547,7 @@ var require_scale4 = __commonJS({
|
|
|
10547
10547
|
const results = objects.map((object) => {
|
|
10548
10548
|
if (path2.isA(object)) return path2.transform(matrix, object);
|
|
10549
10549
|
if (geom2.isA(object)) return geom2.transform(matrix, object);
|
|
10550
|
-
if (
|
|
10550
|
+
if (geom34.isA(object)) return geom34.transform(matrix, object);
|
|
10551
10551
|
return object;
|
|
10552
10552
|
});
|
|
10553
10553
|
return results.length === 1 ? results[0] : results;
|
|
@@ -10570,7 +10570,7 @@ var require_transform11 = __commonJS({
|
|
|
10570
10570
|
"use strict";
|
|
10571
10571
|
var flatten = require_flatten();
|
|
10572
10572
|
var geom2 = require_geom2();
|
|
10573
|
-
var
|
|
10573
|
+
var geom34 = require_geom3();
|
|
10574
10574
|
var path2 = require_path2();
|
|
10575
10575
|
var transform = (matrix, ...objects) => {
|
|
10576
10576
|
objects = flatten(objects);
|
|
@@ -10578,7 +10578,7 @@ var require_transform11 = __commonJS({
|
|
|
10578
10578
|
const results = objects.map((object) => {
|
|
10579
10579
|
if (path2.isA(object)) return path2.transform(matrix, object);
|
|
10580
10580
|
if (geom2.isA(object)) return geom2.transform(matrix, object);
|
|
10581
|
-
if (
|
|
10581
|
+
if (geom34.isA(object)) return geom34.transform(matrix, object);
|
|
10582
10582
|
return object;
|
|
10583
10583
|
});
|
|
10584
10584
|
return results.length === 1 ? results[0] : results;
|
|
@@ -10624,7 +10624,7 @@ var require_colorize = __commonJS({
|
|
|
10624
10624
|
"use strict";
|
|
10625
10625
|
var flatten = require_flatten();
|
|
10626
10626
|
var geom2 = require_geom2();
|
|
10627
|
-
var
|
|
10627
|
+
var geom34 = require_geom3();
|
|
10628
10628
|
var path2 = require_path2();
|
|
10629
10629
|
var poly3 = require_poly3();
|
|
10630
10630
|
var colorGeom2 = (color, object) => {
|
|
@@ -10633,7 +10633,7 @@ var require_colorize = __commonJS({
|
|
|
10633
10633
|
return newgeom2;
|
|
10634
10634
|
};
|
|
10635
10635
|
var colorGeom3 = (color, object) => {
|
|
10636
|
-
const newgeom3 =
|
|
10636
|
+
const newgeom3 = geom34.clone(object);
|
|
10637
10637
|
newgeom3.color = color;
|
|
10638
10638
|
return newgeom3;
|
|
10639
10639
|
};
|
|
@@ -10655,7 +10655,7 @@ var require_colorize = __commonJS({
|
|
|
10655
10655
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
10656
10656
|
const results = objects.map((object) => {
|
|
10657
10657
|
if (geom2.isA(object)) return colorGeom2(color, object);
|
|
10658
|
-
if (
|
|
10658
|
+
if (geom34.isA(object)) return colorGeom3(color, object);
|
|
10659
10659
|
if (path2.isA(object)) return colorPath2(color, object);
|
|
10660
10660
|
if (poly3.isA(object)) return colorPoly3(color, object);
|
|
10661
10661
|
object.color = color;
|
|
@@ -11635,7 +11635,7 @@ var require_measureArea3 = __commonJS({
|
|
|
11635
11635
|
"use strict";
|
|
11636
11636
|
var flatten = require_flatten();
|
|
11637
11637
|
var geom2 = require_geom2();
|
|
11638
|
-
var
|
|
11638
|
+
var geom34 = require_geom3();
|
|
11639
11639
|
var path2 = require_path2();
|
|
11640
11640
|
var poly3 = require_poly3();
|
|
11641
11641
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -11652,7 +11652,7 @@ var require_measureArea3 = __commonJS({
|
|
|
11652
11652
|
var measureAreaOfGeom3 = (geometry) => {
|
|
11653
11653
|
let area = cache.get(geometry);
|
|
11654
11654
|
if (area) return area;
|
|
11655
|
-
const polygons =
|
|
11655
|
+
const polygons = geom34.toPolygons(geometry);
|
|
11656
11656
|
area = polygons.reduce((area2, polygon4) => area2 + poly3.measureArea(polygon4), 0);
|
|
11657
11657
|
cache.set(geometry, area);
|
|
11658
11658
|
return area;
|
|
@@ -11663,7 +11663,7 @@ var require_measureArea3 = __commonJS({
|
|
|
11663
11663
|
const results = geometries.map((geometry) => {
|
|
11664
11664
|
if (path2.isA(geometry)) return measureAreaOfPath2(geometry);
|
|
11665
11665
|
if (geom2.isA(geometry)) return measureAreaOfGeom2(geometry);
|
|
11666
|
-
if (
|
|
11666
|
+
if (geom34.isA(geometry)) return measureAreaOfGeom3(geometry);
|
|
11667
11667
|
return 0;
|
|
11668
11668
|
});
|
|
11669
11669
|
return results.length === 1 ? results[0] : results;
|
|
@@ -11699,7 +11699,7 @@ var require_measureAggregateEpsilon = __commonJS({
|
|
|
11699
11699
|
var flatten = require_flatten();
|
|
11700
11700
|
var measureAggregateBoundingBox = require_measureAggregateBoundingBox();
|
|
11701
11701
|
var calculateEpsilonFromBounds = require_calculateEpsilonFromBounds();
|
|
11702
|
-
var { geom2, geom3:
|
|
11702
|
+
var { geom2, geom3: geom34, path2 } = require_geometries();
|
|
11703
11703
|
var measureAggregateEpsilon = (...geometries) => {
|
|
11704
11704
|
geometries = flatten(geometries);
|
|
11705
11705
|
if (geometries.length === 0) throw new Error("measureAggregateEpsilon: no geometries supplied");
|
|
@@ -11707,7 +11707,7 @@ var require_measureAggregateEpsilon = __commonJS({
|
|
|
11707
11707
|
let dimensions = 0;
|
|
11708
11708
|
dimensions = geometries.reduce((dimensions2, geometry) => {
|
|
11709
11709
|
if (path2.isA(geometry) || geom2.isA(geometry)) return Math.max(dimensions2, 2);
|
|
11710
|
-
if (
|
|
11710
|
+
if (geom34.isA(geometry)) return Math.max(dimensions2, 3);
|
|
11711
11711
|
return 0;
|
|
11712
11712
|
}, dimensions);
|
|
11713
11713
|
return calculateEpsilonFromBounds(bounds, dimensions);
|
|
@@ -11722,7 +11722,7 @@ var require_measureVolume = __commonJS({
|
|
|
11722
11722
|
"use strict";
|
|
11723
11723
|
var flatten = require_flatten();
|
|
11724
11724
|
var geom2 = require_geom2();
|
|
11725
|
-
var
|
|
11725
|
+
var geom34 = require_geom3();
|
|
11726
11726
|
var path2 = require_path2();
|
|
11727
11727
|
var poly3 = require_poly3();
|
|
11728
11728
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -11731,7 +11731,7 @@ var require_measureVolume = __commonJS({
|
|
|
11731
11731
|
var measureVolumeOfGeom3 = (geometry) => {
|
|
11732
11732
|
let volume = cache.get(geometry);
|
|
11733
11733
|
if (volume) return volume;
|
|
11734
|
-
const polygons =
|
|
11734
|
+
const polygons = geom34.toPolygons(geometry);
|
|
11735
11735
|
volume = polygons.reduce((volume2, polygon4) => volume2 + poly3.measureSignedVolume(polygon4), 0);
|
|
11736
11736
|
cache.set(geometry, volume);
|
|
11737
11737
|
return volume;
|
|
@@ -11742,7 +11742,7 @@ var require_measureVolume = __commonJS({
|
|
|
11742
11742
|
const results = geometries.map((geometry) => {
|
|
11743
11743
|
if (path2.isA(geometry)) return measureVolumeOfPath2(geometry);
|
|
11744
11744
|
if (geom2.isA(geometry)) return measureVolumeOfGeom2(geometry);
|
|
11745
|
-
if (
|
|
11745
|
+
if (geom34.isA(geometry)) return measureVolumeOfGeom3(geometry);
|
|
11746
11746
|
return 0;
|
|
11747
11747
|
});
|
|
11748
11748
|
return results.length === 1 ? results[0] : results;
|
|
@@ -11779,7 +11779,7 @@ var require_measureBoundingSphere2 = __commonJS({
|
|
|
11779
11779
|
var vec2 = require_vec2();
|
|
11780
11780
|
var vec3 = require_vec3();
|
|
11781
11781
|
var geom2 = require_geom2();
|
|
11782
|
-
var
|
|
11782
|
+
var geom34 = require_geom3();
|
|
11783
11783
|
var path2 = require_path2();
|
|
11784
11784
|
var poly3 = require_poly3();
|
|
11785
11785
|
var cacheOfBoundingSpheres = /* @__PURE__ */ new WeakMap();
|
|
@@ -11834,7 +11834,7 @@ var require_measureBoundingSphere2 = __commonJS({
|
|
|
11834
11834
|
if (boundingSphere !== void 0) return boundingSphere;
|
|
11835
11835
|
const centroid = vec3.create();
|
|
11836
11836
|
let radius = 0;
|
|
11837
|
-
const polygons =
|
|
11837
|
+
const polygons = geom34.toPolygons(geometry);
|
|
11838
11838
|
if (polygons.length > 0) {
|
|
11839
11839
|
let numPoints = 0;
|
|
11840
11840
|
polygons.forEach((polygon4) => {
|
|
@@ -11860,7 +11860,7 @@ var require_measureBoundingSphere2 = __commonJS({
|
|
|
11860
11860
|
const results = geometries.map((geometry) => {
|
|
11861
11861
|
if (path2.isA(geometry)) return measureBoundingSphereOfPath2(geometry);
|
|
11862
11862
|
if (geom2.isA(geometry)) return measureBoundingSphereOfGeom2(geometry);
|
|
11863
|
-
if (
|
|
11863
|
+
if (geom34.isA(geometry)) return measureBoundingSphereOfGeom3(geometry);
|
|
11864
11864
|
return [[0, 0, 0], 0];
|
|
11865
11865
|
});
|
|
11866
11866
|
return results.length === 1 ? results[0] : results;
|
|
@@ -11874,11 +11874,11 @@ var require_measureCenter = __commonJS({
|
|
|
11874
11874
|
"node_modules/@jscad/modeling/src/measurements/measureCenter.js"(exports, module) {
|
|
11875
11875
|
"use strict";
|
|
11876
11876
|
var flatten = require_flatten();
|
|
11877
|
-
var
|
|
11877
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
11878
11878
|
var measureCenter = (...geometries) => {
|
|
11879
11879
|
geometries = flatten(geometries);
|
|
11880
11880
|
const results = geometries.map((geometry) => {
|
|
11881
|
-
const bounds =
|
|
11881
|
+
const bounds = measureBoundingBox4(geometry);
|
|
11882
11882
|
return [
|
|
11883
11883
|
bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2,
|
|
11884
11884
|
bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2,
|
|
@@ -11898,7 +11898,7 @@ var require_measureCenterOfMass = __commonJS({
|
|
|
11898
11898
|
var flatten = require_flatten();
|
|
11899
11899
|
var vec3 = require_vec3();
|
|
11900
11900
|
var geom2 = require_geom2();
|
|
11901
|
-
var
|
|
11901
|
+
var geom34 = require_geom3();
|
|
11902
11902
|
var cacheOfCenterOfMass = /* @__PURE__ */ new WeakMap();
|
|
11903
11903
|
var measureCenterOfMassGeom2 = (geometry) => {
|
|
11904
11904
|
let centerOfMass = cacheOfCenterOfMass.get(geometry);
|
|
@@ -11929,7 +11929,7 @@ var require_measureCenterOfMass = __commonJS({
|
|
|
11929
11929
|
let centerOfMass = cacheOfCenterOfMass.get(geometry);
|
|
11930
11930
|
if (centerOfMass !== void 0) return centerOfMass;
|
|
11931
11931
|
centerOfMass = vec3.create();
|
|
11932
|
-
const polygons =
|
|
11932
|
+
const polygons = geom34.toPolygons(geometry);
|
|
11933
11933
|
if (polygons.length === 0) return centerOfMass;
|
|
11934
11934
|
let totalVolume = 0;
|
|
11935
11935
|
const vector = vec3.create();
|
|
@@ -11953,7 +11953,7 @@ var require_measureCenterOfMass = __commonJS({
|
|
|
11953
11953
|
geometries = flatten(geometries);
|
|
11954
11954
|
const results = geometries.map((geometry) => {
|
|
11955
11955
|
if (geom2.isA(geometry)) return measureCenterOfMassGeom2(geometry);
|
|
11956
|
-
if (
|
|
11956
|
+
if (geom34.isA(geometry)) return measureCenterOfMassGeom3(geometry);
|
|
11957
11957
|
return [0, 0, 0];
|
|
11958
11958
|
});
|
|
11959
11959
|
return results.length === 1 ? results[0] : results;
|
|
@@ -11967,11 +11967,11 @@ var require_measureDimensions = __commonJS({
|
|
|
11967
11967
|
"node_modules/@jscad/modeling/src/measurements/measureDimensions.js"(exports, module) {
|
|
11968
11968
|
"use strict";
|
|
11969
11969
|
var flatten = require_flatten();
|
|
11970
|
-
var
|
|
11970
|
+
var measureBoundingBox4 = require_measureBoundingBox2();
|
|
11971
11971
|
var measureDimensions = (...geometries) => {
|
|
11972
11972
|
geometries = flatten(geometries);
|
|
11973
11973
|
const results = geometries.map((geometry) => {
|
|
11974
|
-
const boundingBox =
|
|
11974
|
+
const boundingBox = measureBoundingBox4(geometry);
|
|
11975
11975
|
return [
|
|
11976
11976
|
boundingBox[1][0] - boundingBox[0][0],
|
|
11977
11977
|
boundingBox[1][1] - boundingBox[0][1],
|
|
@@ -12281,15 +12281,15 @@ var require_text = __commonJS({
|
|
|
12281
12281
|
var require_intersectGeom3Sub = __commonJS({
|
|
12282
12282
|
"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom3Sub.js"(exports, module) {
|
|
12283
12283
|
"use strict";
|
|
12284
|
-
var
|
|
12284
|
+
var geom34 = require_geom3();
|
|
12285
12285
|
var mayOverlap = require_mayOverlap();
|
|
12286
12286
|
var { Tree } = require_trees();
|
|
12287
12287
|
var intersectGeom3Sub = (geometry1, geometry2) => {
|
|
12288
12288
|
if (!mayOverlap(geometry1, geometry2)) {
|
|
12289
|
-
return
|
|
12289
|
+
return geom34.create();
|
|
12290
12290
|
}
|
|
12291
|
-
const a = new Tree(
|
|
12292
|
-
const b = new Tree(
|
|
12291
|
+
const a = new Tree(geom34.toPolygons(geometry1));
|
|
12292
|
+
const b = new Tree(geom34.toPolygons(geometry2));
|
|
12293
12293
|
a.invert();
|
|
12294
12294
|
b.clipTo(a);
|
|
12295
12295
|
b.invert();
|
|
@@ -12298,7 +12298,7 @@ var require_intersectGeom3Sub = __commonJS({
|
|
|
12298
12298
|
a.addPolygons(b.allPolygons());
|
|
12299
12299
|
a.invert();
|
|
12300
12300
|
const newpolygons = a.allPolygons();
|
|
12301
|
-
return
|
|
12301
|
+
return geom34.create(newpolygons);
|
|
12302
12302
|
};
|
|
12303
12303
|
module.exports = intersectGeom3Sub;
|
|
12304
12304
|
}
|
|
@@ -12329,7 +12329,7 @@ var require_intersectGeom2 = __commonJS({
|
|
|
12329
12329
|
"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom2.js"(exports, module) {
|
|
12330
12330
|
"use strict";
|
|
12331
12331
|
var flatten = require_flatten();
|
|
12332
|
-
var
|
|
12332
|
+
var geom34 = require_geom3();
|
|
12333
12333
|
var measureEpsilon = require_measureEpsilon();
|
|
12334
12334
|
var fromFakePolygons = require_fromFakePolygons();
|
|
12335
12335
|
var to3DWalls = require_to3DWalls();
|
|
@@ -12339,7 +12339,7 @@ var require_intersectGeom2 = __commonJS({
|
|
|
12339
12339
|
const newgeometries = geometries.map((geometry) => to3DWalls({ z0: -1, z1: 1 }, geometry));
|
|
12340
12340
|
const newgeom3 = intersectGeom3(newgeometries);
|
|
12341
12341
|
const epsilon = measureEpsilon(newgeom3);
|
|
12342
|
-
return fromFakePolygons(epsilon,
|
|
12342
|
+
return fromFakePolygons(epsilon, geom34.toPolygons(newgeom3));
|
|
12343
12343
|
};
|
|
12344
12344
|
module.exports = intersect;
|
|
12345
12345
|
}
|
|
@@ -12352,7 +12352,7 @@ var require_intersect2 = __commonJS({
|
|
|
12352
12352
|
var flatten = require_flatten();
|
|
12353
12353
|
var areAllShapesTheSameType = require_areAllShapesTheSameType();
|
|
12354
12354
|
var geom2 = require_geom2();
|
|
12355
|
-
var
|
|
12355
|
+
var geom34 = require_geom3();
|
|
12356
12356
|
var intersectGeom2 = require_intersectGeom2();
|
|
12357
12357
|
var intersectGeom3 = require_intersectGeom3();
|
|
12358
12358
|
var intersect = (...geometries) => {
|
|
@@ -12363,7 +12363,7 @@ var require_intersect2 = __commonJS({
|
|
|
12363
12363
|
}
|
|
12364
12364
|
const geometry = geometries[0];
|
|
12365
12365
|
if (geom2.isA(geometry)) return intersectGeom2(geometries);
|
|
12366
|
-
if (
|
|
12366
|
+
if (geom34.isA(geometry)) return intersectGeom3(geometries);
|
|
12367
12367
|
return geometry;
|
|
12368
12368
|
};
|
|
12369
12369
|
module.exports = intersect;
|
|
@@ -12376,7 +12376,7 @@ var require_scissionGeom3 = __commonJS({
|
|
|
12376
12376
|
"use strict";
|
|
12377
12377
|
var vec3 = require_vec3();
|
|
12378
12378
|
var measureEpsilon = require_measureEpsilon();
|
|
12379
|
-
var
|
|
12379
|
+
var geom34 = require_geom3();
|
|
12380
12380
|
var sortNb = (array) => array.sort((a, b) => a - b).filter((item, pos, ary) => !pos || item !== ary[pos - 1]);
|
|
12381
12381
|
var insertMapping = (map, point, index) => {
|
|
12382
12382
|
const key = `${point}`;
|
|
@@ -12393,7 +12393,7 @@ var require_scissionGeom3 = __commonJS({
|
|
|
12393
12393
|
};
|
|
12394
12394
|
var scissionGeom3 = (geometry) => {
|
|
12395
12395
|
const eps = measureEpsilon(geometry);
|
|
12396
|
-
const polygons =
|
|
12396
|
+
const polygons = geom34.toPolygons(geometry);
|
|
12397
12397
|
const pl = polygons.length;
|
|
12398
12398
|
const indexesPerPoint = /* @__PURE__ */ new Map();
|
|
12399
12399
|
const temp = vec3.create();
|
|
@@ -12438,7 +12438,7 @@ var require_scissionGeom3 = __commonJS({
|
|
|
12438
12438
|
if (indexesPerPolygon[i].indexes) {
|
|
12439
12439
|
const newpolygons = [];
|
|
12440
12440
|
indexesPerPolygon[i].indexes.forEach((e, p) => newpolygons.push(polygons[p]));
|
|
12441
|
-
newgeometries.push(
|
|
12441
|
+
newgeometries.push(geom34.create(newpolygons));
|
|
12442
12442
|
}
|
|
12443
12443
|
}
|
|
12444
12444
|
return newgeometries;
|
|
@@ -12452,13 +12452,13 @@ var require_scission = __commonJS({
|
|
|
12452
12452
|
"node_modules/@jscad/modeling/src/operations/booleans/scission.js"(exports, module) {
|
|
12453
12453
|
"use strict";
|
|
12454
12454
|
var flatten = require_flatten();
|
|
12455
|
-
var
|
|
12455
|
+
var geom34 = require_geom3();
|
|
12456
12456
|
var scissionGeom3 = require_scissionGeom3();
|
|
12457
12457
|
var scission = (...objects) => {
|
|
12458
12458
|
objects = flatten(objects);
|
|
12459
12459
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
12460
12460
|
const results = objects.map((object) => {
|
|
12461
|
-
if (
|
|
12461
|
+
if (geom34.isA(object)) return scissionGeom3(object);
|
|
12462
12462
|
return object;
|
|
12463
12463
|
});
|
|
12464
12464
|
return results.length === 1 ? results[0] : results;
|
|
@@ -12471,22 +12471,22 @@ var require_scission = __commonJS({
|
|
|
12471
12471
|
var require_subtractGeom3Sub = __commonJS({
|
|
12472
12472
|
"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom3Sub.js"(exports, module) {
|
|
12473
12473
|
"use strict";
|
|
12474
|
-
var
|
|
12474
|
+
var geom34 = require_geom3();
|
|
12475
12475
|
var mayOverlap = require_mayOverlap();
|
|
12476
12476
|
var { Tree } = require_trees();
|
|
12477
12477
|
var subtractGeom3Sub = (geometry1, geometry2) => {
|
|
12478
12478
|
if (!mayOverlap(geometry1, geometry2)) {
|
|
12479
|
-
return
|
|
12479
|
+
return geom34.clone(geometry1);
|
|
12480
12480
|
}
|
|
12481
|
-
const a = new Tree(
|
|
12482
|
-
const b = new Tree(
|
|
12481
|
+
const a = new Tree(geom34.toPolygons(geometry1));
|
|
12482
|
+
const b = new Tree(geom34.toPolygons(geometry2));
|
|
12483
12483
|
a.invert();
|
|
12484
12484
|
a.clipTo(b);
|
|
12485
12485
|
b.clipTo(a, true);
|
|
12486
12486
|
a.addPolygons(b.allPolygons());
|
|
12487
12487
|
a.invert();
|
|
12488
12488
|
const newpolygons = a.allPolygons();
|
|
12489
|
-
return
|
|
12489
|
+
return geom34.create(newpolygons);
|
|
12490
12490
|
};
|
|
12491
12491
|
module.exports = subtractGeom3Sub;
|
|
12492
12492
|
}
|
|
@@ -12499,7 +12499,7 @@ var require_subtractGeom3 = __commonJS({
|
|
|
12499
12499
|
var flatten = require_flatten();
|
|
12500
12500
|
var retessellate = require_retessellate();
|
|
12501
12501
|
var subtractSub = require_subtractGeom3Sub();
|
|
12502
|
-
var
|
|
12502
|
+
var subtract3 = (...geometries) => {
|
|
12503
12503
|
geometries = flatten(geometries);
|
|
12504
12504
|
let newgeometry = geometries.shift();
|
|
12505
12505
|
geometries.forEach((geometry) => {
|
|
@@ -12508,7 +12508,7 @@ var require_subtractGeom3 = __commonJS({
|
|
|
12508
12508
|
newgeometry = retessellate(newgeometry);
|
|
12509
12509
|
return newgeometry;
|
|
12510
12510
|
};
|
|
12511
|
-
module.exports =
|
|
12511
|
+
module.exports = subtract3;
|
|
12512
12512
|
}
|
|
12513
12513
|
});
|
|
12514
12514
|
|
|
@@ -12517,19 +12517,19 @@ var require_subtractGeom2 = __commonJS({
|
|
|
12517
12517
|
"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom2.js"(exports, module) {
|
|
12518
12518
|
"use strict";
|
|
12519
12519
|
var flatten = require_flatten();
|
|
12520
|
-
var
|
|
12520
|
+
var geom34 = require_geom3();
|
|
12521
12521
|
var measureEpsilon = require_measureEpsilon();
|
|
12522
12522
|
var fromFakePolygons = require_fromFakePolygons();
|
|
12523
12523
|
var to3DWalls = require_to3DWalls();
|
|
12524
12524
|
var subtractGeom3 = require_subtractGeom3();
|
|
12525
|
-
var
|
|
12525
|
+
var subtract3 = (...geometries) => {
|
|
12526
12526
|
geometries = flatten(geometries);
|
|
12527
12527
|
const newgeometries = geometries.map((geometry) => to3DWalls({ z0: -1, z1: 1 }, geometry));
|
|
12528
12528
|
const newgeom3 = subtractGeom3(newgeometries);
|
|
12529
12529
|
const epsilon = measureEpsilon(newgeom3);
|
|
12530
|
-
return fromFakePolygons(epsilon,
|
|
12530
|
+
return fromFakePolygons(epsilon, geom34.toPolygons(newgeom3));
|
|
12531
12531
|
};
|
|
12532
|
-
module.exports =
|
|
12532
|
+
module.exports = subtract3;
|
|
12533
12533
|
}
|
|
12534
12534
|
});
|
|
12535
12535
|
|
|
@@ -12540,10 +12540,10 @@ var require_subtract4 = __commonJS({
|
|
|
12540
12540
|
var flatten = require_flatten();
|
|
12541
12541
|
var areAllShapesTheSameType = require_areAllShapesTheSameType();
|
|
12542
12542
|
var geom2 = require_geom2();
|
|
12543
|
-
var
|
|
12543
|
+
var geom34 = require_geom3();
|
|
12544
12544
|
var subtractGeom2 = require_subtractGeom2();
|
|
12545
12545
|
var subtractGeom3 = require_subtractGeom3();
|
|
12546
|
-
var
|
|
12546
|
+
var subtract3 = (...geometries) => {
|
|
12547
12547
|
geometries = flatten(geometries);
|
|
12548
12548
|
if (geometries.length === 0) throw new Error("wrong number of arguments");
|
|
12549
12549
|
if (!areAllShapesTheSameType(geometries)) {
|
|
@@ -12551,10 +12551,10 @@ var require_subtract4 = __commonJS({
|
|
|
12551
12551
|
}
|
|
12552
12552
|
const geometry = geometries[0];
|
|
12553
12553
|
if (geom2.isA(geometry)) return subtractGeom2(geometries);
|
|
12554
|
-
if (
|
|
12554
|
+
if (geom34.isA(geometry)) return subtractGeom3(geometries);
|
|
12555
12555
|
return geometry;
|
|
12556
12556
|
};
|
|
12557
|
-
module.exports =
|
|
12557
|
+
module.exports = subtract3;
|
|
12558
12558
|
}
|
|
12559
12559
|
});
|
|
12560
12560
|
|
|
@@ -12713,7 +12713,7 @@ var require_toUniquePoints = __commonJS({
|
|
|
12713
12713
|
"node_modules/@jscad/modeling/src/operations/hulls/toUniquePoints.js"(exports, module) {
|
|
12714
12714
|
"use strict";
|
|
12715
12715
|
var geom2 = require_geom2();
|
|
12716
|
-
var
|
|
12716
|
+
var geom34 = require_geom3();
|
|
12717
12717
|
var path2 = require_path2();
|
|
12718
12718
|
var toUniquePoints = (geometries) => {
|
|
12719
12719
|
const found = /* @__PURE__ */ new Set();
|
|
@@ -12728,8 +12728,8 @@ var require_toUniquePoints = __commonJS({
|
|
|
12728
12728
|
geometries.forEach((geometry) => {
|
|
12729
12729
|
if (geom2.isA(geometry)) {
|
|
12730
12730
|
geom2.toPoints(geometry).forEach(addPoint);
|
|
12731
|
-
} else if (
|
|
12732
|
-
|
|
12731
|
+
} else if (geom34.isA(geometry)) {
|
|
12732
|
+
geom34.toPoints(geometry).forEach((points) => points.forEach(addPoint));
|
|
12733
12733
|
} else if (path2.isA(geometry)) {
|
|
12734
12734
|
path2.toPoints(geometry).forEach(addPoint);
|
|
12735
12735
|
}
|
|
@@ -12800,14 +12800,14 @@ var require_hullGeom3 = __commonJS({
|
|
|
12800
12800
|
"node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(exports, module) {
|
|
12801
12801
|
"use strict";
|
|
12802
12802
|
var flatten = require_flatten();
|
|
12803
|
-
var
|
|
12803
|
+
var geom34 = require_geom3();
|
|
12804
12804
|
var toUniquePoints = require_toUniquePoints();
|
|
12805
12805
|
var hullPoints3 = require_hullPoints3();
|
|
12806
12806
|
var hullGeom3 = (...geometries) => {
|
|
12807
12807
|
geometries = flatten(geometries);
|
|
12808
12808
|
const unique = toUniquePoints(geometries);
|
|
12809
|
-
if (unique.length === 0) return
|
|
12810
|
-
return
|
|
12809
|
+
if (unique.length === 0) return geom34.create();
|
|
12810
|
+
return geom34.create(hullPoints3(unique));
|
|
12811
12811
|
};
|
|
12812
12812
|
module.exports = hullGeom3;
|
|
12813
12813
|
}
|
|
@@ -12820,7 +12820,7 @@ var require_hull = __commonJS({
|
|
|
12820
12820
|
var flatten = require_flatten();
|
|
12821
12821
|
var areAllShapesTheSameType = require_areAllShapesTheSameType();
|
|
12822
12822
|
var geom2 = require_geom2();
|
|
12823
|
-
var
|
|
12823
|
+
var geom34 = require_geom3();
|
|
12824
12824
|
var path2 = require_path2();
|
|
12825
12825
|
var hullPath2 = require_hullPath2();
|
|
12826
12826
|
var hullGeom2 = require_hullGeom2();
|
|
@@ -12834,7 +12834,7 @@ var require_hull = __commonJS({
|
|
|
12834
12834
|
const geometry = geometries[0];
|
|
12835
12835
|
if (path2.isA(geometry)) return hullPath2(geometries);
|
|
12836
12836
|
if (geom2.isA(geometry)) return hullGeom2(geometries);
|
|
12837
|
-
if (
|
|
12837
|
+
if (geom34.isA(geometry)) return hullGeom3(geometries);
|
|
12838
12838
|
return geometry;
|
|
12839
12839
|
};
|
|
12840
12840
|
module.exports = hull;
|
|
@@ -13363,7 +13363,7 @@ var require_generalize = __commonJS({
|
|
|
13363
13363
|
var flatten = require_flatten();
|
|
13364
13364
|
var measureEpsilon = require_measureEpsilon();
|
|
13365
13365
|
var geom2 = require_geom2();
|
|
13366
|
-
var
|
|
13366
|
+
var geom34 = require_geom3();
|
|
13367
13367
|
var path2 = require_path2();
|
|
13368
13368
|
var snapPolygons = require_snapPolygons();
|
|
13369
13369
|
var mergePolygons = require_mergePolygons();
|
|
@@ -13379,7 +13379,7 @@ var require_generalize = __commonJS({
|
|
|
13379
13379
|
};
|
|
13380
13380
|
const { snap, simplify, triangulate } = Object.assign({}, defaults, options);
|
|
13381
13381
|
const epsilon = measureEpsilon(geometry);
|
|
13382
|
-
let polygons =
|
|
13382
|
+
let polygons = geom34.toPolygons(geometry);
|
|
13383
13383
|
if (snap) {
|
|
13384
13384
|
polygons = snapPolygons(epsilon, polygons);
|
|
13385
13385
|
}
|
|
@@ -13400,7 +13400,7 @@ var require_generalize = __commonJS({
|
|
|
13400
13400
|
const results = geometries.map((geometry) => {
|
|
13401
13401
|
if (path2.isA(geometry)) return generalizePath2(options, geometry);
|
|
13402
13402
|
if (geom2.isA(geometry)) return generalizeGeom2(options, geometry);
|
|
13403
|
-
if (
|
|
13403
|
+
if (geom34.isA(geometry)) return generalizeGeom3(options, geometry);
|
|
13404
13404
|
throw new Error("invalid geometry");
|
|
13405
13405
|
});
|
|
13406
13406
|
return results.length === 1 ? results[0] : results;
|
|
@@ -13416,7 +13416,7 @@ var require_snap3 = __commonJS({
|
|
|
13416
13416
|
var flatten = require_flatten();
|
|
13417
13417
|
var vec2 = require_vec2();
|
|
13418
13418
|
var geom2 = require_geom2();
|
|
13419
|
-
var
|
|
13419
|
+
var geom34 = require_geom3();
|
|
13420
13420
|
var path2 = require_path2();
|
|
13421
13421
|
var measureEpsilon = require_measureEpsilon();
|
|
13422
13422
|
var snapPolygons = require_snapPolygons();
|
|
@@ -13435,9 +13435,9 @@ var require_snap3 = __commonJS({
|
|
|
13435
13435
|
};
|
|
13436
13436
|
var snapGeom3 = (geometry) => {
|
|
13437
13437
|
const epsilon = measureEpsilon(geometry);
|
|
13438
|
-
const polygons =
|
|
13438
|
+
const polygons = geom34.toPolygons(geometry);
|
|
13439
13439
|
const newpolygons = snapPolygons(epsilon, polygons);
|
|
13440
|
-
return
|
|
13440
|
+
return geom34.create(newpolygons);
|
|
13441
13441
|
};
|
|
13442
13442
|
var snap = (...geometries) => {
|
|
13443
13443
|
geometries = flatten(geometries);
|
|
@@ -13445,7 +13445,7 @@ var require_snap3 = __commonJS({
|
|
|
13445
13445
|
const results = geometries.map((geometry) => {
|
|
13446
13446
|
if (path2.isA(geometry)) return snapPath2(geometry);
|
|
13447
13447
|
if (geom2.isA(geometry)) return snapGeom2(geometry);
|
|
13448
|
-
if (
|
|
13448
|
+
if (geom34.isA(geometry)) return snapGeom3(geometry);
|
|
13449
13449
|
return geometry;
|
|
13450
13450
|
});
|
|
13451
13451
|
return results.length === 1 ? results[0] : results;
|
|
@@ -14971,18 +14971,24 @@ var createBoardMesh = (board, options) => {
|
|
|
14971
14971
|
boundingBox
|
|
14972
14972
|
};
|
|
14973
14973
|
};
|
|
14974
|
+
|
|
14975
|
+
// lib/utils/pcb-panel-geometry.ts
|
|
14976
|
+
var import_transforms3 = __toESM(require_transforms(), 1);
|
|
14977
|
+
var import_booleans2 = __toESM(require_booleans(), 1);
|
|
14978
|
+
var geom32 = __toESM(require_geom3(), 1);
|
|
14979
|
+
var import_measureBoundingBox2 = __toESM(require_measureBoundingBox2(), 1);
|
|
14974
14980
|
var createPanelMesh = (panel, options) => {
|
|
14975
14981
|
const { thickness, holes = [], platedHoles = [] } = options;
|
|
14976
14982
|
const center = panel.center ?? { x: 0, y: 0 };
|
|
14977
14983
|
let panelGeom = createBoardOutlineGeom(panel, center, thickness);
|
|
14978
14984
|
const holeGeoms = createHoleGeoms(center, thickness, holes, platedHoles);
|
|
14979
14985
|
if (holeGeoms.length > 0) {
|
|
14980
|
-
panelGeom = (0,
|
|
14986
|
+
panelGeom = (0, import_booleans2.subtract)(panelGeom, ...holeGeoms);
|
|
14981
14987
|
}
|
|
14982
|
-
panelGeom = (0,
|
|
14983
|
-
const polygons =
|
|
14988
|
+
panelGeom = (0, import_transforms3.rotateX)(-Math.PI / 2, panelGeom);
|
|
14989
|
+
const polygons = geom32.toPolygons(panelGeom);
|
|
14984
14990
|
const triangles = geom3ToTriangles(panelGeom, polygons);
|
|
14985
|
-
const bboxValues = (0,
|
|
14991
|
+
const bboxValues = (0, import_measureBoundingBox2.default)(panelGeom);
|
|
14986
14992
|
const boundingBox = createBoundingBox(bboxValues);
|
|
14987
14993
|
return {
|
|
14988
14994
|
triangles,
|
|
@@ -14993,12 +14999,11 @@ var createPanelMesh = (panel, options) => {
|
|
|
14993
14999
|
// lib/converters/circuit-to-3d.ts
|
|
14994
15000
|
var import_extrusions3 = __toESM(require_extrusions(), 1);
|
|
14995
15001
|
var import_primitives3 = __toESM(require_primitives(), 1);
|
|
14996
|
-
var
|
|
14997
|
-
var
|
|
14998
|
-
var
|
|
15002
|
+
var import_transforms4 = __toESM(require_transforms(), 1);
|
|
15003
|
+
var geom33 = __toESM(require_geom3(), 1);
|
|
15004
|
+
var import_measureBoundingBox3 = __toESM(require_measureBoundingBox2(), 1);
|
|
14999
15005
|
var DEFAULT_BOARD_THICKNESS = 1.6;
|
|
15000
15006
|
var DEFAULT_COMPONENT_HEIGHT = 2;
|
|
15001
|
-
var COPPER_THICKNESS = 0.035;
|
|
15002
15007
|
function convertRotationFromCadRotation(rot) {
|
|
15003
15008
|
return {
|
|
15004
15009
|
x: rot.x * Math.PI / 180,
|
|
@@ -15111,63 +15116,6 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
|
|
|
15111
15116
|
}
|
|
15112
15117
|
boxes.push(boardBox);
|
|
15113
15118
|
}
|
|
15114
|
-
const pcbPours = db.pcb_copper_pour?.list?.() ?? [];
|
|
15115
|
-
for (const pour of pcbPours) {
|
|
15116
|
-
const isBottomLayer = pour.layer === "bottom";
|
|
15117
|
-
const y = isBottomLayer ? -(effectiveBoardThickness / 2) - COPPER_THICKNESS / 2 : effectiveBoardThickness / 2 + COPPER_THICKNESS / 2;
|
|
15118
|
-
if (pour.shape === "rect") {
|
|
15119
|
-
const box = {
|
|
15120
|
-
center: {
|
|
15121
|
-
x: pour.center.x,
|
|
15122
|
-
y,
|
|
15123
|
-
z: pour.center.y
|
|
15124
|
-
},
|
|
15125
|
-
size: {
|
|
15126
|
-
x: pour.width,
|
|
15127
|
-
y: COPPER_THICKNESS,
|
|
15128
|
-
z: pour.height
|
|
15129
|
-
},
|
|
15130
|
-
rotation: { x: 0, y: 0, z: 0 },
|
|
15131
|
-
color: pour.covered_with_solder_mask ? pcbColor : copperColor
|
|
15132
|
-
};
|
|
15133
|
-
if (pour.rotation && typeof pour.rotation === "number") {
|
|
15134
|
-
box.rotation.y = -(pour.rotation * Math.PI) / 180;
|
|
15135
|
-
}
|
|
15136
|
-
boxes.push(box);
|
|
15137
|
-
} else if (pour.shape === "polygon") {
|
|
15138
|
-
const { points } = pour;
|
|
15139
|
-
let center_x = 0;
|
|
15140
|
-
let center_y = 0;
|
|
15141
|
-
for (const p of points) {
|
|
15142
|
-
center_x += p.x;
|
|
15143
|
-
center_y += p.y;
|
|
15144
|
-
}
|
|
15145
|
-
center_x /= points.length;
|
|
15146
|
-
center_y /= points.length;
|
|
15147
|
-
const relativePoints = points.map((p) => [
|
|
15148
|
-
p.x - center_x,
|
|
15149
|
-
-(p.y - center_y)
|
|
15150
|
-
]);
|
|
15151
|
-
if (arePointsClockwise(relativePoints)) {
|
|
15152
|
-
relativePoints.reverse();
|
|
15153
|
-
}
|
|
15154
|
-
const shape2d = (0, import_primitives3.polygon)({ points: relativePoints });
|
|
15155
|
-
let geom = (0, import_extrusions3.extrudeLinear)({ height: COPPER_THICKNESS }, shape2d);
|
|
15156
|
-
geom = (0, import_transforms3.translate)([0, 0, -COPPER_THICKNESS / 2], geom);
|
|
15157
|
-
geom = (0, import_transforms3.rotateX)(-Math.PI / 2, geom);
|
|
15158
|
-
const triangles = geom3ToTriangles(geom);
|
|
15159
|
-
const bbox = createBoundingBox((0, import_measureBoundingBox2.default)(geom));
|
|
15160
|
-
const mesh = { triangles, boundingBox: bbox };
|
|
15161
|
-
const box = {
|
|
15162
|
-
center: { x: center_x, y, z: center_y },
|
|
15163
|
-
size: { x: 1, y: 1, z: 1 },
|
|
15164
|
-
// size doesn't matter much as we provide mesh
|
|
15165
|
-
mesh,
|
|
15166
|
-
color: pour.covered_with_solder_mask ? pcbColor : copperColor
|
|
15167
|
-
};
|
|
15168
|
-
boxes.push(box);
|
|
15169
|
-
}
|
|
15170
|
-
}
|
|
15171
15119
|
const cadComponents = db.cad_component?.list?.() ?? [];
|
|
15172
15120
|
const pcbComponentIdsWith3D = /* @__PURE__ */ new Set();
|
|
15173
15121
|
for (const cad of cadComponents) {
|