@tscircuit/3d-viewer 0.0.217 → 0.0.218
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 +221 -176
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1937,7 +1937,7 @@ var require_toString3 = __commonJS({
|
|
|
1937
1937
|
var require_translate = __commonJS({
|
|
1938
1938
|
"node_modules/@jscad/modeling/src/maths/mat4/translate.js"(exports, module) {
|
|
1939
1939
|
"use strict";
|
|
1940
|
-
var
|
|
1940
|
+
var translate5 = (out, matrix, offsets) => {
|
|
1941
1941
|
const x = offsets[0];
|
|
1942
1942
|
const y = offsets[1];
|
|
1943
1943
|
const z = offsets[2];
|
|
@@ -1990,7 +1990,7 @@ var require_translate = __commonJS({
|
|
|
1990
1990
|
}
|
|
1991
1991
|
return out;
|
|
1992
1992
|
};
|
|
1993
|
-
module.exports =
|
|
1993
|
+
module.exports = translate5;
|
|
1994
1994
|
}
|
|
1995
1995
|
});
|
|
1996
1996
|
|
|
@@ -5766,11 +5766,11 @@ var require_line = __commonJS({
|
|
|
5766
5766
|
"node_modules/@jscad/modeling/src/primitives/line.js"(exports, module) {
|
|
5767
5767
|
"use strict";
|
|
5768
5768
|
var path2 = require_path2();
|
|
5769
|
-
var
|
|
5769
|
+
var line3 = (points) => {
|
|
5770
5770
|
if (!Array.isArray(points)) throw new Error("points must be an array");
|
|
5771
5771
|
return path2.fromPoints({}, points);
|
|
5772
5772
|
};
|
|
5773
|
-
module.exports =
|
|
5773
|
+
module.exports = line3;
|
|
5774
5774
|
}
|
|
5775
5775
|
});
|
|
5776
5776
|
|
|
@@ -7699,7 +7699,7 @@ var require_translate2 = __commonJS({
|
|
|
7699
7699
|
var geom2 = require_geom2();
|
|
7700
7700
|
var geom3 = require_geom3();
|
|
7701
7701
|
var path2 = require_path2();
|
|
7702
|
-
var
|
|
7702
|
+
var translate5 = (offset, ...objects) => {
|
|
7703
7703
|
if (!Array.isArray(offset)) throw new Error("offset must be an array");
|
|
7704
7704
|
objects = flatten(objects);
|
|
7705
7705
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
@@ -7714,11 +7714,11 @@ var require_translate2 = __commonJS({
|
|
|
7714
7714
|
});
|
|
7715
7715
|
return results.length === 1 ? results[0] : results;
|
|
7716
7716
|
};
|
|
7717
|
-
var translateX = (offset, ...objects) =>
|
|
7718
|
-
var translateY = (offset, ...objects) =>
|
|
7719
|
-
var translateZ = (offset, ...objects) =>
|
|
7717
|
+
var translateX = (offset, ...objects) => translate5([offset, 0, 0], objects);
|
|
7718
|
+
var translateY = (offset, ...objects) => translate5([0, offset, 0], objects);
|
|
7719
|
+
var translateZ = (offset, ...objects) => translate5([0, 0, offset], objects);
|
|
7720
7720
|
module.exports = {
|
|
7721
|
-
translate:
|
|
7721
|
+
translate: translate5,
|
|
7722
7722
|
translateX,
|
|
7723
7723
|
translateY,
|
|
7724
7724
|
translateZ
|
|
@@ -7733,7 +7733,7 @@ var require_torus = __commonJS({
|
|
|
7733
7733
|
var { TAU } = require_constants();
|
|
7734
7734
|
var extrudeRotate = require_extrudeRotate();
|
|
7735
7735
|
var { rotate: rotate2 } = require_rotate3();
|
|
7736
|
-
var { translate:
|
|
7736
|
+
var { translate: translate5 } = require_translate2();
|
|
7737
7737
|
var circle = require_circle();
|
|
7738
7738
|
var { isGT, isGTE } = require_commonChecks();
|
|
7739
7739
|
var torus = (options) => {
|
|
@@ -7758,7 +7758,7 @@ var require_torus = __commonJS({
|
|
|
7758
7758
|
if (innerRotation !== 0) {
|
|
7759
7759
|
innerCircle = rotate2([0, 0, innerRotation], innerCircle);
|
|
7760
7760
|
}
|
|
7761
|
-
innerCircle =
|
|
7761
|
+
innerCircle = translate5([outerRadius, 0], innerCircle);
|
|
7762
7762
|
const extrudeOptions = {
|
|
7763
7763
|
startAngle,
|
|
7764
7764
|
angle: outerRotation,
|
|
@@ -7944,7 +7944,7 @@ var require_colorize = __commonJS({
|
|
|
7944
7944
|
newpoly.color = color;
|
|
7945
7945
|
return newpoly;
|
|
7946
7946
|
};
|
|
7947
|
-
var
|
|
7947
|
+
var colorize5 = (color, ...objects) => {
|
|
7948
7948
|
if (!Array.isArray(color)) throw new Error("color must be an array");
|
|
7949
7949
|
if (color.length < 3) throw new Error("color must contain R, G and B values");
|
|
7950
7950
|
if (color.length === 3) color = [color[0], color[1], color[2], 1];
|
|
@@ -7960,7 +7960,7 @@ var require_colorize = __commonJS({
|
|
|
7960
7960
|
});
|
|
7961
7961
|
return results.length === 1 ? results[0] : results;
|
|
7962
7962
|
};
|
|
7963
|
-
module.exports =
|
|
7963
|
+
module.exports = colorize5;
|
|
7964
7964
|
}
|
|
7965
7965
|
});
|
|
7966
7966
|
|
|
@@ -8477,7 +8477,7 @@ var require_extrudeLinear = __commonJS({
|
|
|
8477
8477
|
var path2 = require_path2();
|
|
8478
8478
|
var extrudeLinearGeom2 = require_extrudeLinearGeom2();
|
|
8479
8479
|
var extrudeLinearPath2 = require_extrudeLinearPath2();
|
|
8480
|
-
var
|
|
8480
|
+
var extrudeLinear4 = (options, ...objects) => {
|
|
8481
8481
|
const defaults = {
|
|
8482
8482
|
height: 1,
|
|
8483
8483
|
twistAngle: 0,
|
|
@@ -8495,7 +8495,7 @@ var require_extrudeLinear = __commonJS({
|
|
|
8495
8495
|
});
|
|
8496
8496
|
return results.length === 1 ? results[0] : results;
|
|
8497
8497
|
};
|
|
8498
|
-
module.exports =
|
|
8498
|
+
module.exports = extrudeLinear4;
|
|
8499
8499
|
}
|
|
8500
8500
|
});
|
|
8501
8501
|
|
|
@@ -8513,11 +8513,11 @@ var require_clone10 = __commonJS({
|
|
|
8513
8513
|
"node_modules/@jscad/modeling/src/maths/line2/clone.js"(exports, module) {
|
|
8514
8514
|
"use strict";
|
|
8515
8515
|
var create = require_create11();
|
|
8516
|
-
var clone = (
|
|
8516
|
+
var clone = (line3) => {
|
|
8517
8517
|
const out = create();
|
|
8518
|
-
out[0] =
|
|
8519
|
-
out[1] =
|
|
8520
|
-
out[2] =
|
|
8518
|
+
out[0] = line3[0];
|
|
8519
|
+
out[1] = line3[1];
|
|
8520
|
+
out[2] = line3[2];
|
|
8521
8521
|
return out;
|
|
8522
8522
|
};
|
|
8523
8523
|
module.exports = clone;
|
|
@@ -8529,8 +8529,8 @@ var require_direction = __commonJS({
|
|
|
8529
8529
|
"node_modules/@jscad/modeling/src/maths/line2/direction.js"(exports, module) {
|
|
8530
8530
|
"use strict";
|
|
8531
8531
|
var vec2 = require_vec2();
|
|
8532
|
-
var direction = (
|
|
8533
|
-
const vector = vec2.normal(vec2.create(),
|
|
8532
|
+
var direction = (line3) => {
|
|
8533
|
+
const vector = vec2.normal(vec2.create(), line3);
|
|
8534
8534
|
vec2.negate(vector, vector);
|
|
8535
8535
|
return vector;
|
|
8536
8536
|
};
|
|
@@ -8543,7 +8543,7 @@ var require_origin = __commonJS({
|
|
|
8543
8543
|
"node_modules/@jscad/modeling/src/maths/line2/origin.js"(exports, module) {
|
|
8544
8544
|
"use strict";
|
|
8545
8545
|
var vec2 = require_vec2();
|
|
8546
|
-
var origin = (
|
|
8546
|
+
var origin = (line3) => vec2.scale(vec2.create(), line3, line3[2]);
|
|
8547
8547
|
module.exports = origin;
|
|
8548
8548
|
}
|
|
8549
8549
|
});
|
|
@@ -8555,9 +8555,9 @@ var require_closestPoint = __commonJS({
|
|
|
8555
8555
|
var vec2 = require_vec2();
|
|
8556
8556
|
var direction = require_direction();
|
|
8557
8557
|
var origin = require_origin();
|
|
8558
|
-
var closestPoint = (
|
|
8559
|
-
const orig = origin(
|
|
8560
|
-
const dir = direction(
|
|
8558
|
+
var closestPoint = (line3, point) => {
|
|
8559
|
+
const orig = origin(line3);
|
|
8560
|
+
const dir = direction(line3);
|
|
8561
8561
|
const v = vec2.subtract(vec2.create(), point, orig);
|
|
8562
8562
|
const dist = vec2.dot(v, dir);
|
|
8563
8563
|
vec2.scale(v, dir, dist);
|
|
@@ -8572,10 +8572,10 @@ var require_closestPoint = __commonJS({
|
|
|
8572
8572
|
var require_copy5 = __commonJS({
|
|
8573
8573
|
"node_modules/@jscad/modeling/src/maths/line2/copy.js"(exports, module) {
|
|
8574
8574
|
"use strict";
|
|
8575
|
-
var copy = (out,
|
|
8576
|
-
out[0] =
|
|
8577
|
-
out[1] =
|
|
8578
|
-
out[2] =
|
|
8575
|
+
var copy = (out, line3) => {
|
|
8576
|
+
out[0] = line3[0];
|
|
8577
|
+
out[1] = line3[1];
|
|
8578
|
+
out[2] = line3[2];
|
|
8579
8579
|
return out;
|
|
8580
8580
|
};
|
|
8581
8581
|
module.exports = copy;
|
|
@@ -8587,9 +8587,9 @@ var require_distanceToPoint = __commonJS({
|
|
|
8587
8587
|
"node_modules/@jscad/modeling/src/maths/line2/distanceToPoint.js"(exports, module) {
|
|
8588
8588
|
"use strict";
|
|
8589
8589
|
var vec2 = require_vec2();
|
|
8590
|
-
var distanceToPoint = (
|
|
8591
|
-
let distance = vec2.dot(point,
|
|
8592
|
-
distance = Math.abs(distance -
|
|
8590
|
+
var distanceToPoint = (line3, point) => {
|
|
8591
|
+
let distance = vec2.dot(point, line3);
|
|
8592
|
+
distance = Math.abs(distance - line3[2]);
|
|
8593
8593
|
return distance;
|
|
8594
8594
|
};
|
|
8595
8595
|
module.exports = distanceToPoint;
|
|
@@ -8600,7 +8600,7 @@ var require_distanceToPoint = __commonJS({
|
|
|
8600
8600
|
var require_equals7 = __commonJS({
|
|
8601
8601
|
"node_modules/@jscad/modeling/src/maths/line2/equals.js"(exports, module) {
|
|
8602
8602
|
"use strict";
|
|
8603
|
-
var equals = (line1,
|
|
8603
|
+
var equals = (line1, line22) => line1[0] === line22[0] && (line1[1] === line22[1] && line1[2] === line22[2]);
|
|
8604
8604
|
module.exports = equals;
|
|
8605
8605
|
}
|
|
8606
8606
|
});
|
|
@@ -8646,8 +8646,8 @@ var require_intersectPointOfLines = __commonJS({
|
|
|
8646
8646
|
"use strict";
|
|
8647
8647
|
var vec2 = require_vec2();
|
|
8648
8648
|
var { solve2Linear } = require_utils();
|
|
8649
|
-
var intersectToLine = (line1,
|
|
8650
|
-
const point = solve2Linear(line1[0], line1[1],
|
|
8649
|
+
var intersectToLine = (line1, line22) => {
|
|
8650
|
+
const point = solve2Linear(line1[0], line1[1], line22[0], line22[1], line1[2], line22[2]);
|
|
8651
8651
|
return vec2.clone(point);
|
|
8652
8652
|
};
|
|
8653
8653
|
module.exports = intersectToLine;
|
|
@@ -8661,9 +8661,9 @@ var require_reverse4 = __commonJS({
|
|
|
8661
8661
|
var vec2 = require_vec2();
|
|
8662
8662
|
var copy = require_copy5();
|
|
8663
8663
|
var fromValues = require_fromValues5();
|
|
8664
|
-
var reverse = (out,
|
|
8665
|
-
const normal = vec2.negate(vec2.create(),
|
|
8666
|
-
const distance = -
|
|
8664
|
+
var reverse = (out, line3) => {
|
|
8665
|
+
const normal = vec2.negate(vec2.create(), line3);
|
|
8666
|
+
const distance = -line3[2];
|
|
8667
8667
|
return copy(out, fromValues(normal[0], normal[1], distance));
|
|
8668
8668
|
};
|
|
8669
8669
|
module.exports = reverse;
|
|
@@ -8674,7 +8674,7 @@ var require_reverse4 = __commonJS({
|
|
|
8674
8674
|
var require_toString10 = __commonJS({
|
|
8675
8675
|
"node_modules/@jscad/modeling/src/maths/line2/toString.js"(exports, module) {
|
|
8676
8676
|
"use strict";
|
|
8677
|
-
var toString = (
|
|
8677
|
+
var toString = (line3) => `line2: (${line3[0].toFixed(7)}, ${line3[1].toFixed(7)}, ${line3[2].toFixed(7)})`;
|
|
8678
8678
|
module.exports = toString;
|
|
8679
8679
|
}
|
|
8680
8680
|
});
|
|
@@ -8687,9 +8687,9 @@ var require_transform10 = __commonJS({
|
|
|
8687
8687
|
var fromPoints = require_fromPoints7();
|
|
8688
8688
|
var origin = require_origin();
|
|
8689
8689
|
var direction = require_direction();
|
|
8690
|
-
var transform2 = (out,
|
|
8691
|
-
const org = origin(
|
|
8692
|
-
const dir = direction(
|
|
8690
|
+
var transform2 = (out, line3, matrix) => {
|
|
8691
|
+
const org = origin(line3);
|
|
8692
|
+
const dir = direction(line3);
|
|
8693
8693
|
vec2.transform(org, org, matrix);
|
|
8694
8694
|
vec2.transform(dir, dir, matrix);
|
|
8695
8695
|
return fromPoints(out, org, dir);
|
|
@@ -8703,10 +8703,10 @@ var require_xAtY = __commonJS({
|
|
|
8703
8703
|
"node_modules/@jscad/modeling/src/maths/line2/xAtY.js"(exports, module) {
|
|
8704
8704
|
"use strict";
|
|
8705
8705
|
var origin = require_origin();
|
|
8706
|
-
var xAtY = (
|
|
8707
|
-
let x = (
|
|
8706
|
+
var xAtY = (line3, y) => {
|
|
8707
|
+
let x = (line3[2] - line3[1] * y) / line3[0];
|
|
8708
8708
|
if (Number.isNaN(x)) {
|
|
8709
|
-
const org = origin(
|
|
8709
|
+
const org = origin(line3);
|
|
8710
8710
|
x = org[0];
|
|
8711
8711
|
}
|
|
8712
8712
|
return x;
|
|
@@ -8745,7 +8745,7 @@ var require_offsetFromPoints = __commonJS({
|
|
|
8745
8745
|
"use strict";
|
|
8746
8746
|
var { EPS, TAU } = require_constants();
|
|
8747
8747
|
var intersect = require_intersect();
|
|
8748
|
-
var
|
|
8748
|
+
var line22 = require_line2();
|
|
8749
8749
|
var vec2 = require_vec2();
|
|
8750
8750
|
var area = require_area();
|
|
8751
8751
|
var offsetFromPoints = (options, points) => {
|
|
@@ -8809,12 +8809,12 @@ var require_offsetFromPoints = __commonJS({
|
|
|
8809
8809
|
if (corners === "edge") {
|
|
8810
8810
|
const pointIndex = /* @__PURE__ */ new Map();
|
|
8811
8811
|
newPoints.forEach((point, index) => pointIndex.set(point, index));
|
|
8812
|
-
const line0 =
|
|
8813
|
-
const line1 =
|
|
8812
|
+
const line0 = line22.create();
|
|
8813
|
+
const line1 = line22.create();
|
|
8814
8814
|
newCorners.forEach((corner) => {
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
const ip =
|
|
8815
|
+
line22.fromPoints(line0, corner.s0[0], corner.s0[1]);
|
|
8816
|
+
line22.fromPoints(line1, corner.s1[0], corner.s1[1]);
|
|
8817
|
+
const ip = line22.intersectPointOfLines(line0, line1);
|
|
8818
8818
|
if (Number.isFinite(ip[0]) && Number.isFinite(ip[1])) {
|
|
8819
8819
|
const p0 = corner.s0[1];
|
|
8820
8820
|
const i = pointIndex.get(p0);
|
|
@@ -9306,7 +9306,7 @@ var require_reTesselateCoplanarPolygons = __commonJS({
|
|
|
9306
9306
|
"node_modules/@jscad/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js"(exports, module) {
|
|
9307
9307
|
"use strict";
|
|
9308
9308
|
var { EPS } = require_constants();
|
|
9309
|
-
var
|
|
9309
|
+
var line22 = require_line2();
|
|
9310
9310
|
var vec2 = require_vec2();
|
|
9311
9311
|
var OrthoNormalBasis = require_OrthoNormalBasis();
|
|
9312
9312
|
var interpolateBetween2DPointsForY = require_interpolateBetween2DPointsForY();
|
|
@@ -9492,8 +9492,8 @@ var require_reTesselateCoplanarPolygons = __commonJS({
|
|
|
9492
9492
|
topright,
|
|
9493
9493
|
bottomleft,
|
|
9494
9494
|
bottomright,
|
|
9495
|
-
leftline:
|
|
9496
|
-
rightline:
|
|
9495
|
+
leftline: line22.fromPoints(line22.create(), topleft, bottomleft),
|
|
9496
|
+
rightline: line22.fromPoints(line22.create(), bottomright, topright)
|
|
9497
9497
|
};
|
|
9498
9498
|
if (newoutpolygonrow.length > 0) {
|
|
9499
9499
|
const prevoutpolygon = newoutpolygonrow[newoutpolygonrow.length - 1];
|
|
@@ -9519,11 +9519,11 @@ var require_reTesselateCoplanarPolygons = __commonJS({
|
|
|
9519
9519
|
if (vec2.distance(prevpolygon.bottomleft, thispolygon.topleft) < EPS) {
|
|
9520
9520
|
if (vec2.distance(prevpolygon.bottomright, thispolygon.topright) < EPS) {
|
|
9521
9521
|
matchedindexes.add(ii);
|
|
9522
|
-
const v1 =
|
|
9523
|
-
const v2 =
|
|
9522
|
+
const v1 = line22.direction(thispolygon.leftline);
|
|
9523
|
+
const v2 = line22.direction(prevpolygon.leftline);
|
|
9524
9524
|
const d1 = v1[0] - v2[0];
|
|
9525
|
-
const v3 =
|
|
9526
|
-
const v4 =
|
|
9525
|
+
const v3 = line22.direction(thispolygon.rightline);
|
|
9526
|
+
const v4 = line22.direction(prevpolygon.rightline);
|
|
9527
9527
|
const d2 = v3[0] - v4[0];
|
|
9528
9528
|
const leftlinecontinues = Math.abs(d1) < EPS;
|
|
9529
9529
|
const rightlinecontinues = Math.abs(d2) < EPS;
|
|
@@ -10627,7 +10627,7 @@ var require_expand = __commonJS({
|
|
|
10627
10627
|
var expandGeom2 = require_expandGeom2();
|
|
10628
10628
|
var expandGeom3 = require_expandGeom3();
|
|
10629
10629
|
var expandPath2 = require_expandPath2();
|
|
10630
|
-
var
|
|
10630
|
+
var expand3 = (options, ...objects) => {
|
|
10631
10631
|
objects = flatten(objects);
|
|
10632
10632
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
10633
10633
|
const results = objects.map((object) => {
|
|
@@ -10638,7 +10638,7 @@ var require_expand = __commonJS({
|
|
|
10638
10638
|
});
|
|
10639
10639
|
return results.length === 1 ? results[0] : results;
|
|
10640
10640
|
};
|
|
10641
|
-
module.exports =
|
|
10641
|
+
module.exports = expand3;
|
|
10642
10642
|
}
|
|
10643
10643
|
});
|
|
10644
10644
|
|
|
@@ -10647,7 +10647,7 @@ var require_extrudeRectangularPath2 = __commonJS({
|
|
|
10647
10647
|
"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangularPath2.js"(exports, module) {
|
|
10648
10648
|
"use strict";
|
|
10649
10649
|
var path2 = require_path2();
|
|
10650
|
-
var
|
|
10650
|
+
var expand3 = require_expand();
|
|
10651
10651
|
var extrudeLinearGeom2 = require_extrudeLinearGeom2();
|
|
10652
10652
|
var extrudeRectangularPath2 = (options, geometry) => {
|
|
10653
10653
|
const defaults = {
|
|
@@ -10659,7 +10659,7 @@ var require_extrudeRectangularPath2 = __commonJS({
|
|
|
10659
10659
|
options.offset = [0, 0, height];
|
|
10660
10660
|
const points = path2.toPoints(geometry);
|
|
10661
10661
|
if (points.length === 0) throw new Error("the given geometry cannot be empty");
|
|
10662
|
-
const newgeometry =
|
|
10662
|
+
const newgeometry = expand3(options, geometry);
|
|
10663
10663
|
return extrudeLinearGeom2(options, newgeometry);
|
|
10664
10664
|
};
|
|
10665
10665
|
module.exports = extrudeRectangularPath2;
|
|
@@ -10673,7 +10673,7 @@ var require_extrudeRectangularGeom2 = __commonJS({
|
|
|
10673
10673
|
var { area } = require_utils();
|
|
10674
10674
|
var geom2 = require_geom2();
|
|
10675
10675
|
var path2 = require_path2();
|
|
10676
|
-
var
|
|
10676
|
+
var expand3 = require_expand();
|
|
10677
10677
|
var extrudeLinearGeom2 = require_extrudeLinearGeom2();
|
|
10678
10678
|
var extrudeRectangularGeom2 = (options, geometry) => {
|
|
10679
10679
|
const defaults = {
|
|
@@ -10687,7 +10687,7 @@ var require_extrudeRectangularGeom2 = __commonJS({
|
|
|
10687
10687
|
if (outlines.length === 0) throw new Error("the given geometry cannot be empty");
|
|
10688
10688
|
const newparts = outlines.map((outline) => {
|
|
10689
10689
|
if (area(outline) < 0) outline.reverse();
|
|
10690
|
-
return
|
|
10690
|
+
return expand3(options, path2.fromPoints({ closed: true }, outline));
|
|
10691
10691
|
});
|
|
10692
10692
|
const allsides = newparts.reduce((sides, part) => sides.concat(geom2.toSides(part)), []);
|
|
10693
10693
|
const newgeometry = geom2.create(allsides);
|
|
@@ -10922,7 +10922,7 @@ var require_align = __commonJS({
|
|
|
10922
10922
|
var flatten = require_flatten();
|
|
10923
10923
|
var padArrayToLength = require_padArrayToLength();
|
|
10924
10924
|
var measureAggregateBoundingBox = require_measureAggregateBoundingBox();
|
|
10925
|
-
var { translate:
|
|
10925
|
+
var { translate: translate5 } = require_translate2();
|
|
10926
10926
|
var validateOptions = (options) => {
|
|
10927
10927
|
if (!Array.isArray(options.modes) || options.modes.length > 3) throw new Error("align(): modes must be an array of length <= 3");
|
|
10928
10928
|
options.modes = padArrayToLength(options.modes, "none", 3);
|
|
@@ -10959,7 +10959,7 @@ var require_align = __commonJS({
|
|
|
10959
10959
|
translation[i] = relativeTo[i] - bounds[0][i];
|
|
10960
10960
|
}
|
|
10961
10961
|
}
|
|
10962
|
-
return
|
|
10962
|
+
return translate5(translation, geometry);
|
|
10963
10963
|
};
|
|
10964
10964
|
var align = (options, ...geometries) => {
|
|
10965
10965
|
const defaults = {
|
|
@@ -10996,7 +10996,7 @@ var require_center = __commonJS({
|
|
|
10996
10996
|
var geom3 = require_geom3();
|
|
10997
10997
|
var path2 = require_path2();
|
|
10998
10998
|
var measureBoundingBox = require_measureBoundingBox2();
|
|
10999
|
-
var { translate:
|
|
10999
|
+
var { translate: translate5 } = require_translate2();
|
|
11000
11000
|
var centerGeometry = (options, object) => {
|
|
11001
11001
|
const defaults = {
|
|
11002
11002
|
axes: [true, true, true],
|
|
@@ -11008,7 +11008,7 @@ var require_center = __commonJS({
|
|
|
11008
11008
|
if (axes[0]) offset[0] = relativeTo[0] - (bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2);
|
|
11009
11009
|
if (axes[1]) offset[1] = relativeTo[1] - (bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2);
|
|
11010
11010
|
if (axes[2]) offset[2] = relativeTo[2] - (bounds[0][2] + (bounds[1][2] - bounds[0][2]) / 2);
|
|
11011
|
-
return
|
|
11011
|
+
return translate5(offset, object);
|
|
11012
11012
|
};
|
|
11013
11013
|
var center = (options, ...objects) => {
|
|
11014
11014
|
const defaults = {
|
|
@@ -11707,9 +11707,9 @@ var require_vectorText = __commonJS({
|
|
|
11707
11707
|
"use strict";
|
|
11708
11708
|
var vectorChar = require_vectorChar();
|
|
11709
11709
|
var vectorParams = require_vectorParams();
|
|
11710
|
-
var translateLine = (options,
|
|
11710
|
+
var translateLine = (options, line3) => {
|
|
11711
11711
|
const { x, y } = Object.assign({ x: 0, y: 0 }, options || {});
|
|
11712
|
-
const segments =
|
|
11712
|
+
const segments = line3.segments;
|
|
11713
11713
|
let segment = null;
|
|
11714
11714
|
let point = null;
|
|
11715
11715
|
for (let i = 0, il = segments.length; i < il; i++) {
|
|
@@ -11719,7 +11719,7 @@ var require_vectorText = __commonJS({
|
|
|
11719
11719
|
segment[j] = [point[0] + x, point[1] + y];
|
|
11720
11720
|
}
|
|
11721
11721
|
}
|
|
11722
|
-
return
|
|
11722
|
+
return line3;
|
|
11723
11723
|
};
|
|
11724
11724
|
var vectorText2 = (options, text) => {
|
|
11725
11725
|
const {
|
|
@@ -11735,15 +11735,15 @@ var require_vectorText = __commonJS({
|
|
|
11735
11735
|
} = vectorParams(options, text);
|
|
11736
11736
|
let [x, y] = [xOffset, yOffset];
|
|
11737
11737
|
let i, il, char, vect, width, diff;
|
|
11738
|
-
let
|
|
11738
|
+
let line3 = { width: 0, segments: [] };
|
|
11739
11739
|
const lines = [];
|
|
11740
11740
|
let output = [];
|
|
11741
11741
|
let maxWidth = 0;
|
|
11742
11742
|
const lineStart = x;
|
|
11743
11743
|
const pushLine = () => {
|
|
11744
|
-
lines.push(
|
|
11745
|
-
maxWidth = Math.max(maxWidth,
|
|
11746
|
-
|
|
11744
|
+
lines.push(line3);
|
|
11745
|
+
maxWidth = Math.max(maxWidth, line3.width);
|
|
11746
|
+
line3 = { width: 0, segments: [] };
|
|
11747
11747
|
};
|
|
11748
11748
|
for (i = 0, il = input.length; i < il; i++) {
|
|
11749
11749
|
char = input[i];
|
|
@@ -11755,26 +11755,26 @@ var require_vectorText = __commonJS({
|
|
|
11755
11755
|
continue;
|
|
11756
11756
|
}
|
|
11757
11757
|
width = vect.width * letterSpacing;
|
|
11758
|
-
|
|
11758
|
+
line3.width += width;
|
|
11759
11759
|
x += width;
|
|
11760
11760
|
if (char !== " ") {
|
|
11761
|
-
|
|
11761
|
+
line3.segments = line3.segments.concat(vect.segments);
|
|
11762
11762
|
}
|
|
11763
11763
|
}
|
|
11764
|
-
if (
|
|
11764
|
+
if (line3.segments.length) {
|
|
11765
11765
|
pushLine();
|
|
11766
11766
|
}
|
|
11767
11767
|
for (i = 0, il = lines.length; i < il; i++) {
|
|
11768
|
-
|
|
11769
|
-
if (maxWidth >
|
|
11770
|
-
diff = maxWidth -
|
|
11768
|
+
line3 = lines[i];
|
|
11769
|
+
if (maxWidth > line3.width) {
|
|
11770
|
+
diff = maxWidth - line3.width;
|
|
11771
11771
|
if (align === "right") {
|
|
11772
|
-
|
|
11772
|
+
line3 = translateLine({ x: diff }, line3);
|
|
11773
11773
|
} else if (align === "center") {
|
|
11774
|
-
|
|
11774
|
+
line3 = translateLine({ x: diff / 2 }, line3);
|
|
11775
11775
|
}
|
|
11776
11776
|
}
|
|
11777
|
-
output = output.concat(
|
|
11777
|
+
output = output.concat(line3.segments);
|
|
11778
11778
|
}
|
|
11779
11779
|
return output;
|
|
11780
11780
|
};
|
|
@@ -12051,10 +12051,10 @@ var require_clone11 = __commonJS({
|
|
|
12051
12051
|
"use strict";
|
|
12052
12052
|
var vec3 = require_vec3();
|
|
12053
12053
|
var create = require_create13();
|
|
12054
|
-
var clone = (
|
|
12054
|
+
var clone = (line3) => {
|
|
12055
12055
|
const out = create();
|
|
12056
|
-
vec3.copy(out[0],
|
|
12057
|
-
vec3.copy(out[1],
|
|
12056
|
+
vec3.copy(out[0], line3[0]);
|
|
12057
|
+
vec3.copy(out[1], line3[1]);
|
|
12058
12058
|
return out;
|
|
12059
12059
|
};
|
|
12060
12060
|
module.exports = clone;
|
|
@@ -12066,9 +12066,9 @@ var require_closestPoint2 = __commonJS({
|
|
|
12066
12066
|
"node_modules/@jscad/modeling/src/maths/line3/closestPoint.js"(exports, module) {
|
|
12067
12067
|
"use strict";
|
|
12068
12068
|
var vec3 = require_vec3();
|
|
12069
|
-
var closestPoint = (
|
|
12070
|
-
const lpoint =
|
|
12071
|
-
const ldirection =
|
|
12069
|
+
var closestPoint = (line3, point) => {
|
|
12070
|
+
const lpoint = line3[0];
|
|
12071
|
+
const ldirection = line3[1];
|
|
12072
12072
|
const a = vec3.dot(vec3.subtract(vec3.create(), point, lpoint), ldirection);
|
|
12073
12073
|
const b = vec3.dot(ldirection, ldirection);
|
|
12074
12074
|
const t = a / b;
|
|
@@ -12085,9 +12085,9 @@ var require_copy6 = __commonJS({
|
|
|
12085
12085
|
"node_modules/@jscad/modeling/src/maths/line3/copy.js"(exports, module) {
|
|
12086
12086
|
"use strict";
|
|
12087
12087
|
var vec3 = require_vec3();
|
|
12088
|
-
var copy = (out,
|
|
12089
|
-
vec3.copy(out[0],
|
|
12090
|
-
vec3.copy(out[1],
|
|
12088
|
+
var copy = (out, line3) => {
|
|
12089
|
+
vec3.copy(out[0], line3[0]);
|
|
12090
|
+
vec3.copy(out[1], line3[1]);
|
|
12091
12091
|
return out;
|
|
12092
12092
|
};
|
|
12093
12093
|
module.exports = copy;
|
|
@@ -12098,7 +12098,7 @@ var require_copy6 = __commonJS({
|
|
|
12098
12098
|
var require_direction2 = __commonJS({
|
|
12099
12099
|
"node_modules/@jscad/modeling/src/maths/line3/direction.js"(exports, module) {
|
|
12100
12100
|
"use strict";
|
|
12101
|
-
var direction = (
|
|
12101
|
+
var direction = (line3) => line3[1];
|
|
12102
12102
|
module.exports = direction;
|
|
12103
12103
|
}
|
|
12104
12104
|
});
|
|
@@ -12109,8 +12109,8 @@ var require_distanceToPoint2 = __commonJS({
|
|
|
12109
12109
|
"use strict";
|
|
12110
12110
|
var vec3 = require_vec3();
|
|
12111
12111
|
var closestPoint = require_closestPoint2();
|
|
12112
|
-
var distanceToPoint = (
|
|
12113
|
-
const closest = closestPoint(
|
|
12112
|
+
var distanceToPoint = (line3, point) => {
|
|
12113
|
+
const closest = closestPoint(line3, point);
|
|
12114
12114
|
const distancevector = vec3.subtract(vec3.create(), point, closest);
|
|
12115
12115
|
return vec3.length(distancevector);
|
|
12116
12116
|
};
|
|
@@ -12123,9 +12123,9 @@ var require_equals8 = __commonJS({
|
|
|
12123
12123
|
"node_modules/@jscad/modeling/src/maths/line3/equals.js"(exports, module) {
|
|
12124
12124
|
"use strict";
|
|
12125
12125
|
var vec3 = require_vec3();
|
|
12126
|
-
var equals = (line1,
|
|
12127
|
-
if (!vec3.equals(line1[1],
|
|
12128
|
-
if (!vec3.equals(line1[0],
|
|
12126
|
+
var equals = (line1, line22) => {
|
|
12127
|
+
if (!vec3.equals(line1[1], line22[1])) return false;
|
|
12128
|
+
if (!vec3.equals(line1[0], line22[0])) return false;
|
|
12129
12129
|
return true;
|
|
12130
12130
|
};
|
|
12131
12131
|
module.exports = equals;
|
|
@@ -12203,11 +12203,11 @@ var require_intersectPointOfLineAndPlane = __commonJS({
|
|
|
12203
12203
|
"node_modules/@jscad/modeling/src/maths/line3/intersectPointOfLineAndPlane.js"(exports, module) {
|
|
12204
12204
|
"use strict";
|
|
12205
12205
|
var vec3 = require_vec3();
|
|
12206
|
-
var intersectToPlane = (
|
|
12206
|
+
var intersectToPlane = (line3, plane) => {
|
|
12207
12207
|
const pnormal = plane;
|
|
12208
12208
|
const pw = plane[3];
|
|
12209
|
-
const lpoint =
|
|
12210
|
-
const ldirection =
|
|
12209
|
+
const lpoint = line3[0];
|
|
12210
|
+
const ldirection = line3[1];
|
|
12211
12211
|
const labda = (pw - vec3.dot(pnormal, lpoint)) / vec3.dot(pnormal, ldirection);
|
|
12212
12212
|
const point = vec3.add(vec3.create(), lpoint, vec3.scale(vec3.create(), ldirection, labda));
|
|
12213
12213
|
return point;
|
|
@@ -12220,7 +12220,7 @@ var require_intersectPointOfLineAndPlane = __commonJS({
|
|
|
12220
12220
|
var require_origin2 = __commonJS({
|
|
12221
12221
|
"node_modules/@jscad/modeling/src/maths/line3/origin.js"(exports, module) {
|
|
12222
12222
|
"use strict";
|
|
12223
|
-
var origin = (
|
|
12223
|
+
var origin = (line3) => line3[0];
|
|
12224
12224
|
module.exports = origin;
|
|
12225
12225
|
}
|
|
12226
12226
|
});
|
|
@@ -12231,9 +12231,9 @@ var require_reverse5 = __commonJS({
|
|
|
12231
12231
|
"use strict";
|
|
12232
12232
|
var vec3 = require_vec3();
|
|
12233
12233
|
var fromPointAndDirection = require_fromPointAndDirection();
|
|
12234
|
-
var reverse = (out,
|
|
12235
|
-
const point = vec3.clone(
|
|
12236
|
-
const direction = vec3.negate(vec3.create(),
|
|
12234
|
+
var reverse = (out, line3) => {
|
|
12235
|
+
const point = vec3.clone(line3[0]);
|
|
12236
|
+
const direction = vec3.negate(vec3.create(), line3[1]);
|
|
12237
12237
|
return fromPointAndDirection(out, point, direction);
|
|
12238
12238
|
};
|
|
12239
12239
|
module.exports = reverse;
|
|
@@ -12244,9 +12244,9 @@ var require_reverse5 = __commonJS({
|
|
|
12244
12244
|
var require_toString11 = __commonJS({
|
|
12245
12245
|
"node_modules/@jscad/modeling/src/maths/line3/toString.js"(exports, module) {
|
|
12246
12246
|
"use strict";
|
|
12247
|
-
var toString = (
|
|
12248
|
-
const point =
|
|
12249
|
-
const direction =
|
|
12247
|
+
var toString = (line3) => {
|
|
12248
|
+
const point = line3[0];
|
|
12249
|
+
const direction = line3[1];
|
|
12250
12250
|
return `line3: point: (${point[0].toFixed(7)}, ${point[1].toFixed(7)}, ${point[2].toFixed(7)}) direction: (${direction[0].toFixed(7)}, ${direction[1].toFixed(7)}, ${direction[2].toFixed(7)})`;
|
|
12251
12251
|
};
|
|
12252
12252
|
module.exports = toString;
|
|
@@ -12259,9 +12259,9 @@ var require_transform12 = __commonJS({
|
|
|
12259
12259
|
"use strict";
|
|
12260
12260
|
var vec3 = require_vec3();
|
|
12261
12261
|
var fromPointAndDirection = require_fromPointAndDirection();
|
|
12262
|
-
var transform2 = (out,
|
|
12263
|
-
const point =
|
|
12264
|
-
const direction =
|
|
12262
|
+
var transform2 = (out, line3, matrix) => {
|
|
12263
|
+
const point = line3[0];
|
|
12264
|
+
const direction = line3[1];
|
|
12265
12265
|
const pointPlusDirection = vec3.add(vec3.create(), point, direction);
|
|
12266
12266
|
const newpoint = vec3.transform(vec3.create(), point, matrix);
|
|
12267
12267
|
const newPointPlusDirection = vec3.transform(pointPlusDirection, pointPlusDirection, matrix);
|
|
@@ -16232,15 +16232,15 @@ var MTLLoader = class extends Loader2 {
|
|
|
16232
16232
|
const delimiter_pattern = /\s+/;
|
|
16233
16233
|
const materialsInfo = {};
|
|
16234
16234
|
for (let i = 0; i < lines.length; i++) {
|
|
16235
|
-
let
|
|
16236
|
-
|
|
16237
|
-
if (
|
|
16235
|
+
let line3 = lines[i];
|
|
16236
|
+
line3 = line3.trim();
|
|
16237
|
+
if (line3.length === 0 || line3.charAt(0) === "#") {
|
|
16238
16238
|
continue;
|
|
16239
16239
|
}
|
|
16240
|
-
const pos =
|
|
16241
|
-
let key = pos >= 0 ?
|
|
16240
|
+
const pos = line3.indexOf(" ");
|
|
16241
|
+
let key = pos >= 0 ? line3.substring(0, pos) : line3;
|
|
16242
16242
|
key = key.toLowerCase();
|
|
16243
|
-
let value = pos >= 0 ?
|
|
16243
|
+
let value = pos >= 0 ? line3.substring(pos + 1) : "";
|
|
16244
16244
|
value = value.trim();
|
|
16245
16245
|
if (key === "newmtl") {
|
|
16246
16246
|
info = { name: value };
|
|
@@ -16753,21 +16753,21 @@ var OBJLoader = class extends Loader3 {
|
|
|
16753
16753
|
text = text.replace(/\\\n/g, "");
|
|
16754
16754
|
}
|
|
16755
16755
|
const lines = text.split("\n");
|
|
16756
|
-
let
|
|
16756
|
+
let line3 = "", lineFirstChar = "";
|
|
16757
16757
|
let lineLength = 0;
|
|
16758
16758
|
let result = [];
|
|
16759
16759
|
const trimLeft = typeof "".trimLeft === "function";
|
|
16760
16760
|
for (let i = 0, l = lines.length; i < l; i++) {
|
|
16761
|
-
|
|
16762
|
-
|
|
16763
|
-
lineLength =
|
|
16761
|
+
line3 = lines[i];
|
|
16762
|
+
line3 = trimLeft ? line3.trimLeft() : line3.trim();
|
|
16763
|
+
lineLength = line3.length;
|
|
16764
16764
|
if (lineLength === 0)
|
|
16765
16765
|
continue;
|
|
16766
|
-
lineFirstChar =
|
|
16766
|
+
lineFirstChar = line3.charAt(0);
|
|
16767
16767
|
if (lineFirstChar === "#")
|
|
16768
16768
|
continue;
|
|
16769
16769
|
if (lineFirstChar === "v") {
|
|
16770
|
-
const data =
|
|
16770
|
+
const data = line3.split(/\s+/);
|
|
16771
16771
|
switch (data[0]) {
|
|
16772
16772
|
case "v":
|
|
16773
16773
|
state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));
|
|
@@ -16785,7 +16785,7 @@ var OBJLoader = class extends Loader3 {
|
|
|
16785
16785
|
break;
|
|
16786
16786
|
}
|
|
16787
16787
|
} else if (lineFirstChar === "f") {
|
|
16788
|
-
const lineData =
|
|
16788
|
+
const lineData = line3.substr(1).trim();
|
|
16789
16789
|
const vertexData = lineData.split(/\s+/);
|
|
16790
16790
|
const faceVertices = [];
|
|
16791
16791
|
for (let j = 0, jl = vertexData.length; j < jl; j++) {
|
|
@@ -16802,10 +16802,10 @@ var OBJLoader = class extends Loader3 {
|
|
|
16802
16802
|
state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2]);
|
|
16803
16803
|
}
|
|
16804
16804
|
} else if (lineFirstChar === "l") {
|
|
16805
|
-
const lineParts =
|
|
16805
|
+
const lineParts = line3.substring(1).trim().split(" ");
|
|
16806
16806
|
let lineVertices = [];
|
|
16807
16807
|
const lineUVs = [];
|
|
16808
|
-
if (
|
|
16808
|
+
if (line3.indexOf("/") === -1) {
|
|
16809
16809
|
lineVertices = lineParts;
|
|
16810
16810
|
} else {
|
|
16811
16811
|
for (let li = 0, llen = lineParts.length; li < llen; li++) {
|
|
@@ -16818,22 +16818,22 @@ var OBJLoader = class extends Loader3 {
|
|
|
16818
16818
|
}
|
|
16819
16819
|
state.addLineGeometry(lineVertices, lineUVs);
|
|
16820
16820
|
} else if (lineFirstChar === "p") {
|
|
16821
|
-
const lineData =
|
|
16821
|
+
const lineData = line3.substr(1).trim();
|
|
16822
16822
|
const pointData = lineData.split(" ");
|
|
16823
16823
|
state.addPointGeometry(pointData);
|
|
16824
|
-
} else if ((result = _object_pattern.exec(
|
|
16824
|
+
} else if ((result = _object_pattern.exec(line3)) !== null) {
|
|
16825
16825
|
const name = (" " + result[0].substr(1).trim()).substr(1);
|
|
16826
16826
|
state.startObject(name);
|
|
16827
|
-
} else if (_material_use_pattern.test(
|
|
16828
|
-
state.object.startMaterial(
|
|
16829
|
-
} else if (_material_library_pattern.test(
|
|
16830
|
-
state.materialLibraries.push(
|
|
16831
|
-
} else if (_map_use_pattern.test(
|
|
16827
|
+
} else if (_material_use_pattern.test(line3)) {
|
|
16828
|
+
state.object.startMaterial(line3.substring(7).trim(), state.materialLibraries);
|
|
16829
|
+
} else if (_material_library_pattern.test(line3)) {
|
|
16830
|
+
state.materialLibraries.push(line3.substring(7).trim());
|
|
16831
|
+
} else if (_map_use_pattern.test(line3)) {
|
|
16832
16832
|
console.warn(
|
|
16833
16833
|
'THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'
|
|
16834
16834
|
);
|
|
16835
16835
|
} else if (lineFirstChar === "s") {
|
|
16836
|
-
result =
|
|
16836
|
+
result = line3.split(" ");
|
|
16837
16837
|
if (result.length > 1) {
|
|
16838
16838
|
const value = result[1].trim().toLowerCase();
|
|
16839
16839
|
state.object.smooth = value !== "0" && value !== "off";
|
|
@@ -16844,9 +16844,9 @@ var OBJLoader = class extends Loader3 {
|
|
|
16844
16844
|
if (material)
|
|
16845
16845
|
material.smooth = state.object.smooth;
|
|
16846
16846
|
} else {
|
|
16847
|
-
if (
|
|
16847
|
+
if (line3 === "\0")
|
|
16848
16848
|
continue;
|
|
16849
|
-
console.warn('THREE.OBJLoader: Unexpected line: "' +
|
|
16849
|
+
console.warn('THREE.OBJLoader: Unexpected line: "' + line3 + '"');
|
|
16850
16850
|
}
|
|
16851
16851
|
}
|
|
16852
16852
|
state.finalize();
|
|
@@ -16982,7 +16982,7 @@ import { Canvas, useFrame as useFrame2 } from "@react-three/fiber";
|
|
|
16982
16982
|
// package.json
|
|
16983
16983
|
var package_default = {
|
|
16984
16984
|
name: "@tscircuit/3d-viewer",
|
|
16985
|
-
version: "0.0.
|
|
16985
|
+
version: "0.0.217",
|
|
16986
16986
|
main: "./dist/index.js",
|
|
16987
16987
|
module: "./dist/index.js",
|
|
16988
16988
|
type: "module",
|
|
@@ -17378,9 +17378,9 @@ var createBoardGeomFromCircuitJson = (circuitJson, opts = {}) => {
|
|
|
17378
17378
|
};
|
|
17379
17379
|
|
|
17380
17380
|
// src/BoardGeomBuilder.ts
|
|
17381
|
-
var
|
|
17382
|
-
var
|
|
17383
|
-
var
|
|
17381
|
+
var import_transforms3 = __toESM(require_transforms(), 1);
|
|
17382
|
+
var import_primitives5 = __toESM(require_primitives(), 1);
|
|
17383
|
+
var import_colors4 = __toESM(require_colors(), 1);
|
|
17384
17384
|
var import_booleans2 = __toESM(require_booleans(), 1);
|
|
17385
17385
|
import { su as su2 } from "@tscircuit/soup-util";
|
|
17386
17386
|
|
|
@@ -17507,8 +17507,8 @@ var platedHole = (plated_hole, ctx) => {
|
|
|
17507
17507
|
};
|
|
17508
17508
|
|
|
17509
17509
|
// src/BoardGeomBuilder.ts
|
|
17510
|
-
var
|
|
17511
|
-
var
|
|
17510
|
+
var import_extrusions3 = __toESM(require_extrusions(), 1);
|
|
17511
|
+
var import_expansions2 = __toESM(require_expansions(), 1);
|
|
17512
17512
|
|
|
17513
17513
|
// src/geoms/create-geoms-for-silkscreen-text.ts
|
|
17514
17514
|
var import_text = __toESM(require_text(), 1);
|
|
@@ -17644,10 +17644,10 @@ peg$SyntaxError.prototype.format = function(sources) {
|
|
|
17644
17644
|
if (src) {
|
|
17645
17645
|
var e = this.location.end;
|
|
17646
17646
|
var filler = peg$padEnd("", offset_s.line.toString().length, " ");
|
|
17647
|
-
var
|
|
17648
|
-
var last = s.line === e.line ? e.column :
|
|
17647
|
+
var line3 = src[s.line - 1];
|
|
17648
|
+
var last = s.line === e.line ? e.column : line3.length + 1;
|
|
17649
17649
|
var hatLen = last - s.column || 1;
|
|
17650
|
-
str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " +
|
|
17650
|
+
str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line3 + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
|
|
17651
17651
|
} else {
|
|
17652
17652
|
str += "\n at " + loc;
|
|
17653
17653
|
}
|
|
@@ -17811,6 +17811,32 @@ function createSilkscreenTextGeoms(silkscreenText) {
|
|
|
17811
17811
|
};
|
|
17812
17812
|
}
|
|
17813
17813
|
|
|
17814
|
+
// src/geoms/create-geoms-for-silkscreen-path.ts
|
|
17815
|
+
var import_primitives4 = __toESM(require_primitives(), 1);
|
|
17816
|
+
var import_expansions = __toESM(require_expansions(), 1);
|
|
17817
|
+
var import_extrusions2 = __toESM(require_extrusions(), 1);
|
|
17818
|
+
var import_transforms2 = __toESM(require_transforms(), 1);
|
|
17819
|
+
var import_colors3 = __toESM(require_colors(), 1);
|
|
17820
|
+
function createSilkscreenPathGeom(sp, ctx) {
|
|
17821
|
+
if (sp.route.length < 2) return void 0;
|
|
17822
|
+
const routePoints = sp.route.map((p) => [p.x, p.y]);
|
|
17823
|
+
const pathLine = (0, import_primitives4.line)(routePoints);
|
|
17824
|
+
const strokeWidth = sp.stroke_width || 0.1;
|
|
17825
|
+
const expandedPath = (0, import_expansions.expand)(
|
|
17826
|
+
{ delta: strokeWidth / 2, corners: "round" },
|
|
17827
|
+
pathLine
|
|
17828
|
+
);
|
|
17829
|
+
const layerSign = sp.layer === "bottom" ? -1 : 1;
|
|
17830
|
+
const zPos = layerSign * ctx.pcbThickness / 2 + layerSign * M * 1.5;
|
|
17831
|
+
let pathGeom = (0, import_transforms2.translate)(
|
|
17832
|
+
[0, 0, zPos],
|
|
17833
|
+
(0, import_extrusions2.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
17834
|
+
// Standard silkscreen thickness
|
|
17835
|
+
);
|
|
17836
|
+
pathGeom = (0, import_colors3.colorize)([1, 1, 1], pathGeom);
|
|
17837
|
+
return pathGeom;
|
|
17838
|
+
}
|
|
17839
|
+
|
|
17814
17840
|
// src/BoardGeomBuilder.ts
|
|
17815
17841
|
var buildStateOrder = [
|
|
17816
17842
|
"initializing",
|
|
@@ -17819,7 +17845,8 @@ var buildStateOrder = [
|
|
|
17819
17845
|
"processing_pads",
|
|
17820
17846
|
"processing_traces",
|
|
17821
17847
|
"processing_vias",
|
|
17822
|
-
"
|
|
17848
|
+
"processing_silkscreen_text",
|
|
17849
|
+
"processing_silkscreen_paths",
|
|
17823
17850
|
"finalizing",
|
|
17824
17851
|
"done"
|
|
17825
17852
|
];
|
|
@@ -17832,6 +17859,7 @@ var BoardGeomBuilder = class {
|
|
|
17832
17859
|
traces;
|
|
17833
17860
|
pcb_vias;
|
|
17834
17861
|
silkscreenTexts;
|
|
17862
|
+
silkscreenPaths;
|
|
17835
17863
|
boardGeom = null;
|
|
17836
17864
|
platedHoleGeoms = [];
|
|
17837
17865
|
holeGeoms = [];
|
|
@@ -17840,7 +17868,8 @@ var BoardGeomBuilder = class {
|
|
|
17840
17868
|
traceGeoms = [];
|
|
17841
17869
|
viaGeoms = [];
|
|
17842
17870
|
// Combined with platedHoleGeoms
|
|
17843
|
-
|
|
17871
|
+
silkscreenTextGeoms = [];
|
|
17872
|
+
silkscreenPathGeoms = [];
|
|
17844
17873
|
state = "initializing";
|
|
17845
17874
|
currentIndex = 0;
|
|
17846
17875
|
ctx;
|
|
@@ -17871,6 +17900,7 @@ var BoardGeomBuilder = class {
|
|
|
17871
17900
|
this.traces = su2(circuitJson).pcb_trace.list();
|
|
17872
17901
|
this.pcb_vias = su2(circuitJson).pcb_via.list();
|
|
17873
17902
|
this.silkscreenTexts = su2(circuitJson).pcb_silkscreen_text.list();
|
|
17903
|
+
this.silkscreenPaths = su2(circuitJson).pcb_silkscreen_path.list();
|
|
17874
17904
|
this.ctx = { pcbThickness: 1.2 };
|
|
17875
17905
|
this.initializeBoard();
|
|
17876
17906
|
}
|
|
@@ -17884,7 +17914,7 @@ var BoardGeomBuilder = class {
|
|
|
17884
17914
|
this.ctx.pcbThickness
|
|
17885
17915
|
);
|
|
17886
17916
|
} else {
|
|
17887
|
-
this.boardGeom = (0,
|
|
17917
|
+
this.boardGeom = (0, import_primitives5.cuboid)({
|
|
17888
17918
|
size: [this.board.width, this.board.height, this.ctx.pcbThickness],
|
|
17889
17919
|
center: [this.board.center.x, this.board.center.y, 0]
|
|
17890
17920
|
});
|
|
@@ -17944,7 +17974,7 @@ var BoardGeomBuilder = class {
|
|
|
17944
17974
|
this.goToNextState();
|
|
17945
17975
|
}
|
|
17946
17976
|
break;
|
|
17947
|
-
case "
|
|
17977
|
+
case "processing_silkscreen_text":
|
|
17948
17978
|
if (this.currentIndex < this.silkscreenTexts.length) {
|
|
17949
17979
|
this.processSilkscreenText(this.silkscreenTexts[this.currentIndex]);
|
|
17950
17980
|
this.currentIndex++;
|
|
@@ -17952,6 +17982,14 @@ var BoardGeomBuilder = class {
|
|
|
17952
17982
|
this.goToNextState();
|
|
17953
17983
|
}
|
|
17954
17984
|
break;
|
|
17985
|
+
case "processing_silkscreen_paths":
|
|
17986
|
+
if (this.currentIndex < this.silkscreenPaths.length) {
|
|
17987
|
+
this.processSilkscreenPath(this.silkscreenPaths[this.currentIndex]);
|
|
17988
|
+
this.currentIndex++;
|
|
17989
|
+
} else {
|
|
17990
|
+
this.goToNextState();
|
|
17991
|
+
}
|
|
17992
|
+
break;
|
|
17955
17993
|
case "finalizing":
|
|
17956
17994
|
this.finalize();
|
|
17957
17995
|
this.state = "done";
|
|
@@ -17963,7 +18001,7 @@ var BoardGeomBuilder = class {
|
|
|
17963
18001
|
processPlatedHole(ph, opts = {}) {
|
|
17964
18002
|
if (!this.boardGeom) return;
|
|
17965
18003
|
if (ph.shape === "circle") {
|
|
17966
|
-
const cyGeom = (0,
|
|
18004
|
+
const cyGeom = (0, import_primitives5.cylinder)({
|
|
17967
18005
|
center: [ph.x, ph.y, 0],
|
|
17968
18006
|
radius: ph.hole_diameter / 2 + M,
|
|
17969
18007
|
// Add margin for subtraction
|
|
@@ -17982,16 +18020,16 @@ var BoardGeomBuilder = class {
|
|
|
17982
18020
|
const holeRadius = holeHeight / 2;
|
|
17983
18021
|
const rectLength = Math.abs(holeWidth - holeHeight);
|
|
17984
18022
|
const pillHole = (0, import_booleans2.union)(
|
|
17985
|
-
(0,
|
|
18023
|
+
(0, import_primitives5.cuboid)({
|
|
17986
18024
|
center: [ph.x, ph.y, 0],
|
|
17987
18025
|
size: shouldRotate ? [holeHeight, rectLength, this.ctx.pcbThickness * 1.5] : [rectLength, holeHeight, this.ctx.pcbThickness * 1.5]
|
|
17988
18026
|
}),
|
|
17989
|
-
(0,
|
|
18027
|
+
(0, import_primitives5.cylinder)({
|
|
17990
18028
|
center: shouldRotate ? [ph.x, ph.y - rectLength / 2, 0] : [ph.x - rectLength / 2, ph.y, 0],
|
|
17991
18029
|
radius: holeRadius,
|
|
17992
18030
|
height: this.ctx.pcbThickness * 1.5
|
|
17993
18031
|
}),
|
|
17994
|
-
(0,
|
|
18032
|
+
(0, import_primitives5.cylinder)({
|
|
17995
18033
|
center: shouldRotate ? [ph.x, ph.y + rectLength / 2, 0] : [ph.x + rectLength / 2, ph.y, 0],
|
|
17996
18034
|
radius: holeRadius,
|
|
17997
18035
|
height: this.ctx.pcbThickness * 1.5
|
|
@@ -18007,7 +18045,7 @@ var BoardGeomBuilder = class {
|
|
|
18007
18045
|
processHole(hole) {
|
|
18008
18046
|
if (!this.boardGeom) return;
|
|
18009
18047
|
if (hole.hole_shape === "round" || hole.hole_shape === "circle") {
|
|
18010
|
-
const cyGeom = (0,
|
|
18048
|
+
const cyGeom = (0, import_primitives5.cylinder)({
|
|
18011
18049
|
center: [hole.x, hole.y, 0],
|
|
18012
18050
|
radius: hole.hole_diameter / 2 + M,
|
|
18013
18051
|
// Add margin for subtraction
|
|
@@ -18021,18 +18059,18 @@ var BoardGeomBuilder = class {
|
|
|
18021
18059
|
const layerSign = pad.layer === "bottom" ? -1 : 1;
|
|
18022
18060
|
const zPos = layerSign * this.ctx.pcbThickness / 2 + layerSign * M * 2;
|
|
18023
18061
|
if (pad.shape === "rect") {
|
|
18024
|
-
const padGeom = (0,
|
|
18062
|
+
const padGeom = (0, import_colors4.colorize)(
|
|
18025
18063
|
colors.copper,
|
|
18026
|
-
(0,
|
|
18064
|
+
(0, import_primitives5.cuboid)({
|
|
18027
18065
|
center: [pad.x, pad.y, zPos],
|
|
18028
18066
|
size: [pad.width, pad.height, M]
|
|
18029
18067
|
})
|
|
18030
18068
|
);
|
|
18031
18069
|
this.padGeoms.push(padGeom);
|
|
18032
18070
|
} else if (pad.shape === "circle") {
|
|
18033
|
-
const padGeom = (0,
|
|
18071
|
+
const padGeom = (0, import_colors4.colorize)(
|
|
18034
18072
|
colors.copper,
|
|
18035
|
-
(0,
|
|
18073
|
+
(0, import_primitives5.cylinder)({
|
|
18036
18074
|
center: [pad.x, pad.y, zPos],
|
|
18037
18075
|
radius: pad.radius,
|
|
18038
18076
|
height: M
|
|
@@ -18051,14 +18089,14 @@ var BoardGeomBuilder = class {
|
|
|
18051
18089
|
if (currentSegmentPoints.length >= 2 && currentLayer) {
|
|
18052
18090
|
const layerSign = currentLayer === "bottom" ? -1 : 1;
|
|
18053
18091
|
const zPos = layerSign * this.ctx.pcbThickness / 2 + layerSign * M;
|
|
18054
|
-
const linePath = (0,
|
|
18055
|
-
const expandedPath = (0,
|
|
18092
|
+
const linePath = (0, import_primitives5.line)(currentSegmentPoints);
|
|
18093
|
+
const expandedPath = (0, import_expansions2.expand)(
|
|
18056
18094
|
{ delta: currentWidth / 2, corners: "round" },
|
|
18057
18095
|
linePath
|
|
18058
18096
|
);
|
|
18059
|
-
let traceGeom = (0,
|
|
18097
|
+
let traceGeom = (0, import_transforms3.translate)(
|
|
18060
18098
|
[0, 0, zPos],
|
|
18061
|
-
(0,
|
|
18099
|
+
(0, import_extrusions3.extrudeLinear)({ height: M }, expandedPath)
|
|
18062
18100
|
);
|
|
18063
18101
|
const startPointCoords = currentSegmentPoints[0];
|
|
18064
18102
|
const endPointCoords = currentSegmentPoints[currentSegmentPoints.length - 1];
|
|
@@ -18067,7 +18105,7 @@ var BoardGeomBuilder = class {
|
|
|
18067
18105
|
startPointCoords[1]
|
|
18068
18106
|
);
|
|
18069
18107
|
if (startHole) {
|
|
18070
|
-
const cuttingCylinder = (0,
|
|
18108
|
+
const cuttingCylinder = (0, import_primitives5.cylinder)({
|
|
18071
18109
|
center: [startPointCoords[0], startPointCoords[1], zPos + M / 2],
|
|
18072
18110
|
radius: startHole.diameter / 2 + M,
|
|
18073
18111
|
height: M
|
|
@@ -18076,7 +18114,7 @@ var BoardGeomBuilder = class {
|
|
|
18076
18114
|
}
|
|
18077
18115
|
const endHole = this.getHoleToCut(endPointCoords[0], endPointCoords[1]);
|
|
18078
18116
|
if (endHole) {
|
|
18079
|
-
const cuttingCylinder = (0,
|
|
18117
|
+
const cuttingCylinder = (0, import_primitives5.cylinder)({
|
|
18080
18118
|
center: [endPointCoords[0], endPointCoords[1], zPos + M / 2],
|
|
18081
18119
|
radius: endHole.diameter / 2 + M,
|
|
18082
18120
|
height: M
|
|
@@ -18084,7 +18122,7 @@ var BoardGeomBuilder = class {
|
|
|
18084
18122
|
traceGeom = (0, import_booleans2.subtract)(traceGeom, cuttingCylinder);
|
|
18085
18123
|
}
|
|
18086
18124
|
const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.fr4GreenSolderWithMask;
|
|
18087
|
-
traceGeom = (0,
|
|
18125
|
+
traceGeom = (0, import_colors4.colorize)(tracesMaterialColor, traceGeom);
|
|
18088
18126
|
this.traceGeoms.push(traceGeom);
|
|
18089
18127
|
}
|
|
18090
18128
|
currentSegmentPoints = [];
|
|
@@ -18151,45 +18189,52 @@ var BoardGeomBuilder = class {
|
|
|
18151
18189
|
point[0] + xOffset + st.anchor_position.x,
|
|
18152
18190
|
point[1] + yOffset + st.anchor_position.y
|
|
18153
18191
|
]);
|
|
18154
|
-
const textPath = (0,
|
|
18192
|
+
const textPath = (0, import_primitives5.line)(alignedOutline);
|
|
18155
18193
|
const fontSize = st.font_size || 0.25;
|
|
18156
18194
|
const expansionDelta = Math.min(
|
|
18157
18195
|
Math.max(0.01, fontSize * 0.1),
|
|
18158
18196
|
fontSize * 0.2
|
|
18159
18197
|
);
|
|
18160
|
-
const expandedPath = (0,
|
|
18198
|
+
const expandedPath = (0, import_expansions2.expand)(
|
|
18161
18199
|
{ delta: expansionDelta, corners: "round" },
|
|
18162
18200
|
textPath
|
|
18163
18201
|
);
|
|
18164
18202
|
let textGeom;
|
|
18165
18203
|
if (st.layer === "bottom") {
|
|
18166
|
-
textGeom = (0,
|
|
18204
|
+
textGeom = (0, import_transforms3.translate)(
|
|
18167
18205
|
[0, 0, -this.ctx.pcbThickness / 2 - M],
|
|
18168
18206
|
// Position above board
|
|
18169
|
-
(0,
|
|
18207
|
+
(0, import_extrusions3.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
18170
18208
|
);
|
|
18171
18209
|
} else {
|
|
18172
|
-
textGeom = (0,
|
|
18210
|
+
textGeom = (0, import_transforms3.translate)(
|
|
18173
18211
|
[0, 0, this.ctx.pcbThickness / 2 + M],
|
|
18174
18212
|
// Position above board
|
|
18175
|
-
(0,
|
|
18213
|
+
(0, import_extrusions3.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
18176
18214
|
);
|
|
18177
18215
|
}
|
|
18178
|
-
textGeom = (0,
|
|
18179
|
-
this.
|
|
18216
|
+
textGeom = (0, import_colors4.colorize)([1, 1, 1], textGeom);
|
|
18217
|
+
this.silkscreenTextGeoms.push(textGeom);
|
|
18218
|
+
}
|
|
18219
|
+
}
|
|
18220
|
+
processSilkscreenPath(sp) {
|
|
18221
|
+
const pathGeom = createSilkscreenPathGeom(sp, this.ctx);
|
|
18222
|
+
if (pathGeom) {
|
|
18223
|
+
this.silkscreenPathGeoms.push(pathGeom);
|
|
18180
18224
|
}
|
|
18181
18225
|
}
|
|
18182
18226
|
finalize() {
|
|
18183
18227
|
if (!this.boardGeom) return;
|
|
18184
18228
|
const boardMaterialColor = boardMaterialColors[this.board.material] ?? colors.fr4Green;
|
|
18185
|
-
this.boardGeom = (0,
|
|
18229
|
+
this.boardGeom = (0, import_colors4.colorize)(boardMaterialColor, this.boardGeom);
|
|
18186
18230
|
this.finalGeoms = [
|
|
18187
18231
|
this.boardGeom,
|
|
18188
18232
|
...this.platedHoleGeoms,
|
|
18189
18233
|
...this.padGeoms,
|
|
18190
18234
|
...this.traceGeoms,
|
|
18191
18235
|
...this.viaGeoms,
|
|
18192
|
-
...this.
|
|
18236
|
+
...this.silkscreenTextGeoms,
|
|
18237
|
+
...this.silkscreenPathGeoms
|
|
18193
18238
|
];
|
|
18194
18239
|
if (this.onCompleteCallback) {
|
|
18195
18240
|
this.onCompleteCallback(this.finalGeoms);
|