@tscircuit/3d-viewer 0.0.524 → 0.0.526

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.
Files changed (2) hide show
  1. package/dist/index.js +419 -349
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4399,6 +4399,52 @@ var require_isA3 = __commonJS({
4399
4399
  }
4400
4400
  });
4401
4401
 
4402
+ // node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js
4403
+ var require_isConvex2 = __commonJS({
4404
+ "node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js"(exports, module) {
4405
+ "use strict";
4406
+ var { EPS } = require_constants();
4407
+ var vec3 = require_vec3();
4408
+ var geom3 = require_isA3();
4409
+ var toPolygons = require_toPolygons();
4410
+ var poly3 = require_poly3();
4411
+ var isConvex = (geometry) => {
4412
+ if (!geom3(geometry)) {
4413
+ throw new Error("isConvex requires a geom3 geometry");
4414
+ }
4415
+ const polygons = toPolygons(geometry);
4416
+ if (polygons.length === 0) {
4417
+ return true;
4418
+ }
4419
+ const vertices = [];
4420
+ const found = /* @__PURE__ */ new Set();
4421
+ for (let i = 0; i < polygons.length; i++) {
4422
+ const verts = polygons[i].vertices;
4423
+ for (let j = 0; j < verts.length; j++) {
4424
+ const v = verts[j];
4425
+ const key = `${v[0]},${v[1]},${v[2]}`;
4426
+ if (!found.has(key)) {
4427
+ found.add(key);
4428
+ vertices.push(v);
4429
+ }
4430
+ }
4431
+ }
4432
+ for (let i = 0; i < polygons.length; i++) {
4433
+ const plane = poly3.plane(polygons[i]);
4434
+ for (let j = 0; j < vertices.length; j++) {
4435
+ const v = vertices[j];
4436
+ const distance4 = vec3.dot(plane, v) - plane[3];
4437
+ if (distance4 > EPS) {
4438
+ return false;
4439
+ }
4440
+ }
4441
+ }
4442
+ return true;
4443
+ };
4444
+ module.exports = isConvex;
4445
+ }
4446
+ });
4447
+
4402
4448
  // node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js
4403
4449
  var require_toPoints3 = __commonJS({
4404
4450
  "node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js"(exports, module) {
@@ -4556,6 +4602,7 @@ var require_geom3 = __commonJS({
4556
4602
  fromCompactBinary: require_fromCompactBinary2(),
4557
4603
  invert: require_invert3(),
4558
4604
  isA: require_isA3(),
4605
+ isConvex: require_isConvex2(),
4559
4606
  toPoints: require_toPoints3(),
4560
4607
  toPolygons: require_toPolygons(),
4561
4608
  toString: require_toString7(),
@@ -4752,7 +4799,7 @@ var require_appendArc = __commonJS({
4752
4799
  } else if (sweepFlag && deltatheta < 0) {
4753
4800
  deltatheta += TAU;
4754
4801
  }
4755
- let numsteps = Math.ceil(Math.abs(deltatheta) / TAU * segments) + 1;
4802
+ let numsteps = Math.floor(segments * (Math.abs(deltatheta) / TAU));
4756
4803
  if (numsteps < 1) numsteps = 1;
4757
4804
  for (let step = 1; step < numsteps; step++) {
4758
4805
  const theta = theta1 + step / numsteps * deltatheta;
@@ -7221,7 +7268,7 @@ var require_arc = __commonJS({
7221
7268
  vec2.add(point, point, centerv);
7222
7269
  pointArray.push(point);
7223
7270
  } else {
7224
- const numsteps = Math.max(1, Math.floor(segments * (rotation / TAU))) + 1;
7271
+ const numsteps = Math.floor(segments * (Math.abs(rotation) / TAU));
7225
7272
  let edgestepsize = numsteps * 0.5 / rotation;
7226
7273
  if (edgestepsize > 0.25) edgestepsize = 0.25;
7227
7274
  const totalsteps = makeTangent ? numsteps + 2 : numsteps;
@@ -11254,6 +11301,205 @@ var require_intersect2 = __commonJS({
11254
11301
  }
11255
11302
  });
11256
11303
 
11304
+ // node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
11305
+ var require_hullPoints3 = __commonJS({
11306
+ "node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
11307
+ "use strict";
11308
+ var poly3 = require_poly3();
11309
+ var quickhull = require_quickhull();
11310
+ var hullPoints3 = (uniquePoints) => {
11311
+ const faces = quickhull(uniquePoints, { skipTriangulation: true });
11312
+ const polygons = faces.map((face) => {
11313
+ const vertices = face.map((index2) => uniquePoints[index2]);
11314
+ return poly3.create(vertices);
11315
+ });
11316
+ return polygons;
11317
+ };
11318
+ module.exports = hullPoints3;
11319
+ }
11320
+ });
11321
+
11322
+ // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
11323
+ var require_unionGeom3Sub = __commonJS({
11324
+ "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
11325
+ "use strict";
11326
+ var geom3 = require_geom3();
11327
+ var mayOverlap = require_mayOverlap();
11328
+ var { Tree } = require_trees();
11329
+ var unionSub = (geometry1, geometry2) => {
11330
+ if (!mayOverlap(geometry1, geometry2)) {
11331
+ return unionForNonIntersecting(geometry1, geometry2);
11332
+ }
11333
+ const a = new Tree(geom3.toPolygons(geometry1));
11334
+ const b = new Tree(geom3.toPolygons(geometry2));
11335
+ a.clipTo(b, false);
11336
+ b.clipTo(a);
11337
+ b.invert();
11338
+ b.clipTo(a);
11339
+ b.invert();
11340
+ const newpolygons = a.allPolygons().concat(b.allPolygons());
11341
+ const result = geom3.create(newpolygons);
11342
+ return result;
11343
+ };
11344
+ var unionForNonIntersecting = (geometry1, geometry2) => {
11345
+ let newpolygons = geom3.toPolygons(geometry1);
11346
+ newpolygons = newpolygons.concat(geom3.toPolygons(geometry2));
11347
+ return geom3.create(newpolygons);
11348
+ };
11349
+ module.exports = unionSub;
11350
+ }
11351
+ });
11352
+
11353
+ // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
11354
+ var require_unionGeom3 = __commonJS({
11355
+ "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
11356
+ "use strict";
11357
+ var flatten = require_flatten();
11358
+ var retessellate = require_retessellate();
11359
+ var unionSub = require_unionGeom3Sub();
11360
+ var union5 = (...geometries) => {
11361
+ geometries = flatten(geometries);
11362
+ let i;
11363
+ for (i = 1; i < geometries.length; i += 2) {
11364
+ geometries.push(unionSub(geometries[i - 1], geometries[i]));
11365
+ }
11366
+ let newgeometry = geometries[i - 1];
11367
+ newgeometry = retessellate(newgeometry);
11368
+ return newgeometry;
11369
+ };
11370
+ module.exports = union5;
11371
+ }
11372
+ });
11373
+
11374
+ // node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js
11375
+ var require_minkowskiSum = __commonJS({
11376
+ "node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js"(exports, module) {
11377
+ "use strict";
11378
+ var flatten = require_flatten();
11379
+ var geom3 = require_geom3();
11380
+ var poly3 = require_poly3();
11381
+ var hullPoints3 = require_hullPoints3();
11382
+ var unionGeom3 = require_unionGeom3();
11383
+ var minkowskiSum = (...geometries) => {
11384
+ geometries = flatten(geometries);
11385
+ if (geometries.length !== 2) {
11386
+ throw new Error("minkowskiSum requires exactly two geometries");
11387
+ }
11388
+ const [geomA, geomB] = geometries;
11389
+ if (!geom3.isA(geomA) || !geom3.isA(geomB)) {
11390
+ throw new Error("minkowskiSum requires geom3 geometries");
11391
+ }
11392
+ const aConvex = geom3.isConvex(geomA);
11393
+ const bConvex = geom3.isConvex(geomB);
11394
+ if (aConvex && bConvex) {
11395
+ return minkowskiSumConvex(geomA, geomB);
11396
+ }
11397
+ if (!aConvex && bConvex) {
11398
+ return minkowskiSumNonConvexConvex(geomA, geomB);
11399
+ }
11400
+ if (aConvex && !bConvex) {
11401
+ return minkowskiSumNonConvexConvex(geomB, geomA);
11402
+ }
11403
+ throw new Error("minkowskiSum of two non-convex geometries is not yet supported");
11404
+ };
11405
+ var minkowskiSumNonConvexConvex = (geomA, geomB) => {
11406
+ const tetrahedra = decomposeIntoTetrahedra(geomA);
11407
+ if (tetrahedra.length === 0) {
11408
+ return geom3.create();
11409
+ }
11410
+ const parts = tetrahedra.map((tet) => minkowskiSumConvex(tet, geomB));
11411
+ if (parts.length === 1) {
11412
+ return parts[0];
11413
+ }
11414
+ return unionGeom3(parts);
11415
+ };
11416
+ var decomposeIntoTetrahedra = (geometry) => {
11417
+ const polygons = geom3.toPolygons(geometry);
11418
+ if (polygons.length === 0) {
11419
+ return [];
11420
+ }
11421
+ const tetrahedra = [];
11422
+ for (let i = 0; i < polygons.length; i++) {
11423
+ const polygon3 = polygons[i];
11424
+ const vertices = polygon3.vertices;
11425
+ let cx = 0, cy = 0, cz = 0;
11426
+ for (let k = 0; k < vertices.length; k++) {
11427
+ cx += vertices[k][0];
11428
+ cy += vertices[k][1];
11429
+ cz += vertices[k][2];
11430
+ }
11431
+ cx /= vertices.length;
11432
+ cy /= vertices.length;
11433
+ cz /= vertices.length;
11434
+ const plane = poly3.plane(polygon3);
11435
+ const nx = plane[0], ny = plane[1], nz = plane[2];
11436
+ const offset4 = 0.1;
11437
+ const apex = [
11438
+ // Vertex used as apex in tetrahedron polygons below
11439
+ cx - nx * offset4,
11440
+ cy - ny * offset4,
11441
+ cz - nz * offset4
11442
+ ];
11443
+ for (let j = 1; j < vertices.length - 1; j++) {
11444
+ const v0 = vertices[0];
11445
+ const v1 = vertices[j];
11446
+ const v2 = vertices[j + 1];
11447
+ const tetPolygons = createTetrahedronPolygons(apex, v0, v1, v2);
11448
+ tetrahedra.push(geom3.create(tetPolygons));
11449
+ }
11450
+ }
11451
+ return tetrahedra;
11452
+ };
11453
+ var createTetrahedronPolygons = (p0, p1, p2, p3) => {
11454
+ return [
11455
+ poly3.create([p0, p2, p1]),
11456
+ // base seen from p3
11457
+ poly3.create([p0, p1, p3]),
11458
+ // face opposite p2
11459
+ poly3.create([p1, p2, p3]),
11460
+ // face opposite p0
11461
+ poly3.create([p2, p0, p3])
11462
+ // face opposite p1
11463
+ ];
11464
+ };
11465
+ var minkowskiSumConvex = (geomA, geomB) => {
11466
+ const pointsA = extractUniqueVertices(geomA);
11467
+ const pointsB = extractUniqueVertices(geomB);
11468
+ if (pointsA.length === 0 || pointsB.length === 0) {
11469
+ return geom3.create();
11470
+ }
11471
+ const summedPoints = [];
11472
+ for (let i = 0; i < pointsA.length; i++) {
11473
+ const a = pointsA[i];
11474
+ for (let j = 0; j < pointsB.length; j++) {
11475
+ const b = pointsB[j];
11476
+ summedPoints.push([a[0] + b[0], a[1] + b[1], a[2] + b[2]]);
11477
+ }
11478
+ }
11479
+ const hullPolygons = hullPoints3(summedPoints);
11480
+ return geom3.create(hullPolygons);
11481
+ };
11482
+ var extractUniqueVertices = (geometry) => {
11483
+ const found = /* @__PURE__ */ new Set();
11484
+ const unique = [];
11485
+ const polygons = geom3.toPolygons(geometry);
11486
+ for (let i = 0; i < polygons.length; i++) {
11487
+ const vertices = polygons[i].vertices;
11488
+ for (let j = 0; j < vertices.length; j++) {
11489
+ const v = vertices[j];
11490
+ const key = `${v[0]},${v[1]},${v[2]}`;
11491
+ if (!found.has(key)) {
11492
+ found.add(key);
11493
+ unique.push(v);
11494
+ }
11495
+ }
11496
+ }
11497
+ return unique;
11498
+ };
11499
+ module.exports = minkowskiSum;
11500
+ }
11501
+ });
11502
+
11257
11503
  // node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js
11258
11504
  var require_scissionGeom3 = __commonJS({
11259
11505
  "node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js"(exports, module) {
@@ -11442,58 +11688,6 @@ var require_subtract4 = __commonJS({
11442
11688
  }
11443
11689
  });
11444
11690
 
11445
- // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
11446
- var require_unionGeom3Sub = __commonJS({
11447
- "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
11448
- "use strict";
11449
- var geom3 = require_geom3();
11450
- var mayOverlap = require_mayOverlap();
11451
- var { Tree } = require_trees();
11452
- var unionSub = (geometry1, geometry2) => {
11453
- if (!mayOverlap(geometry1, geometry2)) {
11454
- return unionForNonIntersecting(geometry1, geometry2);
11455
- }
11456
- const a = new Tree(geom3.toPolygons(geometry1));
11457
- const b = new Tree(geom3.toPolygons(geometry2));
11458
- a.clipTo(b, false);
11459
- b.clipTo(a);
11460
- b.invert();
11461
- b.clipTo(a);
11462
- b.invert();
11463
- const newpolygons = a.allPolygons().concat(b.allPolygons());
11464
- const result = geom3.create(newpolygons);
11465
- return result;
11466
- };
11467
- var unionForNonIntersecting = (geometry1, geometry2) => {
11468
- let newpolygons = geom3.toPolygons(geometry1);
11469
- newpolygons = newpolygons.concat(geom3.toPolygons(geometry2));
11470
- return geom3.create(newpolygons);
11471
- };
11472
- module.exports = unionSub;
11473
- }
11474
- });
11475
-
11476
- // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
11477
- var require_unionGeom3 = __commonJS({
11478
- "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
11479
- "use strict";
11480
- var flatten = require_flatten();
11481
- var retessellate = require_retessellate();
11482
- var unionSub = require_unionGeom3Sub();
11483
- var union5 = (...geometries) => {
11484
- geometries = flatten(geometries);
11485
- let i;
11486
- for (i = 1; i < geometries.length; i += 2) {
11487
- geometries.push(unionSub(geometries[i - 1], geometries[i]));
11488
- }
11489
- let newgeometry = geometries[i - 1];
11490
- newgeometry = retessellate(newgeometry);
11491
- return newgeometry;
11492
- };
11493
- module.exports = union5;
11494
- }
11495
- });
11496
-
11497
11691
  // node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js
11498
11692
  var require_unionGeom2 = __commonJS({
11499
11693
  "node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(exports, module) {
@@ -11546,6 +11740,7 @@ var require_booleans = __commonJS({
11546
11740
  "use strict";
11547
11741
  module.exports = {
11548
11742
  intersect: require_intersect2(),
11743
+ minkowski: require_minkowskiSum(),
11549
11744
  scission: require_scission(),
11550
11745
  subtract: require_subtract4(),
11551
11746
  union: require_union()
@@ -12585,24 +12780,6 @@ var require_hullGeom2 = __commonJS({
12585
12780
  }
12586
12781
  });
12587
12782
 
12588
- // node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
12589
- var require_hullPoints3 = __commonJS({
12590
- "node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
12591
- "use strict";
12592
- var poly3 = require_poly3();
12593
- var quickhull = require_quickhull();
12594
- var hullPoints3 = (uniquePoints) => {
12595
- const faces = quickhull(uniquePoints, { skipTriangulation: true });
12596
- const polygons = faces.map((face) => {
12597
- const vertices = face.map((index2) => uniquePoints[index2]);
12598
- return poly3.create(vertices);
12599
- });
12600
- return polygons;
12601
- };
12602
- module.exports = hullPoints3;
12603
- }
12604
- });
12605
-
12606
12783
  // node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js
12607
12784
  var require_hullGeom3 = __commonJS({
12608
12785
  "node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(exports, module) {
@@ -12682,6 +12859,16 @@ var require_hulls = __commonJS({
12682
12859
  }
12683
12860
  });
12684
12861
 
12862
+ // node_modules/@jscad/modeling/src/operations/minkowski/index.js
12863
+ var require_minkowski = __commonJS({
12864
+ "node_modules/@jscad/modeling/src/operations/minkowski/index.js"(exports, module) {
12865
+ "use strict";
12866
+ module.exports = {
12867
+ minkowskiSum: require_minkowskiSum()
12868
+ };
12869
+ }
12870
+ });
12871
+
12685
12872
  // node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js
12686
12873
  var require_snapPolygons = __commonJS({
12687
12874
  "node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js"(exports, module) {
@@ -13523,6 +13710,7 @@ var require_src = __commonJS({
13523
13710
  expansions: require_expansions(),
13524
13711
  extrusions: require_extrusions(),
13525
13712
  hulls: require_hulls(),
13713
+ minkowski: require_minkowski(),
13526
13714
  modifiers: require_modifiers(),
13527
13715
  transforms: require_transforms()
13528
13716
  };
@@ -23943,6 +24131,7 @@ var A2512 = ({ color = "#333" }) => {
23943
24131
  var FemaleHeader = ({
23944
24132
  x,
23945
24133
  y,
24134
+ z: z18 = 0,
23946
24135
  pitch = 2.54,
23947
24136
  legsLength = 3,
23948
24137
  innerDiameter = 0.945,
@@ -23960,7 +24149,7 @@ var FemaleHeader = ({
23960
24149
  {
23961
24150
  color: "#000",
23962
24151
  size: [bodyLength10, bodyWidth, bodyHeight],
23963
- center: [x, y, flipZ(bodyHeight / 2)]
24152
+ center: [x, y, flipZ(z18 + bodyHeight / 2)]
23964
24153
  }
23965
24154
  ),
23966
24155
  innerDiameter ? /* @__PURE__ */ jsx2(
@@ -23968,14 +24157,14 @@ var FemaleHeader = ({
23968
24157
  {
23969
24158
  height: bodyHeight + 0.1,
23970
24159
  radius: innerDiameter / 2,
23971
- center: [x, y, flipZ(bodyHeight / 2)],
24160
+ center: [x, y, flipZ(z18 + bodyHeight / 2)],
23972
24161
  color: "#222"
23973
24162
  }
23974
24163
  ) : /* @__PURE__ */ jsx2(
23975
24164
  Cuboid,
23976
24165
  {
23977
24166
  size: [gapWidth, gapWidth, bodyHeight],
23978
- center: [x, y, flipZ(bodyHeight / 2)]
24167
+ center: [x, y, flipZ(z18 + bodyHeight / 2)]
23979
24168
  }
23980
24169
  )
23981
24170
  ] }) }),
@@ -23986,7 +24175,7 @@ var FemaleHeader = ({
23986
24175
  {
23987
24176
  color: "silver",
23988
24177
  size: [pinThickness, pinThickness, legsLength * 0.9],
23989
- center: [x, y, flipZ(-legsLength / 2 * 0.9)]
24178
+ center: [x, y, flipZ(z18 + -legsLength / 2 * 0.9)]
23990
24179
  }
23991
24180
  ),
23992
24181
  /* @__PURE__ */ jsx2(
@@ -23994,7 +24183,7 @@ var FemaleHeader = ({
23994
24183
  {
23995
24184
  color: "silver",
23996
24185
  size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
23997
- center: [x, y, flipZ(-legsLength / 2)]
24186
+ center: [x, y, flipZ(z18 + -legsLength / 2)]
23998
24187
  }
23999
24188
  )
24000
24189
  ] }),
@@ -24003,7 +24192,7 @@ var FemaleHeader = ({
24003
24192
  {
24004
24193
  color: "silver",
24005
24194
  size: [gapWidth, gapWidth, gapWidth * 0.5],
24006
- center: [x, y, flipZ(gapWidth / 2 * 0.5)]
24195
+ center: [x, y, flipZ(z18 + gapWidth / 2 * 0.5)]
24007
24196
  }
24008
24197
  )
24009
24198
  ] })
@@ -26531,7 +26720,7 @@ var StampBoard = ({
26531
26720
  for (let i = 0; i < leadsRight; i++) {
26532
26721
  const y = yOffset + i * leadsPitch;
26533
26722
  pads.push({
26534
- x: -halfBoardWidth + leadLength / 2,
26723
+ x: halfBoardWidth - leadLength / 2,
26535
26724
  y: -y,
26536
26725
  // Flip y
26537
26726
  pl: leadLength,
@@ -26539,8 +26728,8 @@ var StampBoard = ({
26539
26728
  });
26540
26729
  if (innerHoles) {
26541
26730
  holes.push(
26542
- { x: -halfBoardWidth, y: -y },
26543
- { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }
26731
+ { x: halfBoardWidth, y: -y },
26732
+ { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }
26544
26733
  );
26545
26734
  }
26546
26735
  }
@@ -26550,7 +26739,7 @@ var StampBoard = ({
26550
26739
  for (let i = 0; i < leadsLeft; i++) {
26551
26740
  const y = yOffset + i * leadsPitch;
26552
26741
  pads.push({
26553
- x: halfBoardWidth - leadLength / 2,
26742
+ x: -halfBoardWidth + leadLength / 2,
26554
26743
  y: -y,
26555
26744
  // Flip y
26556
26745
  pl: leadLength,
@@ -26558,8 +26747,8 @@ var StampBoard = ({
26558
26747
  });
26559
26748
  if (innerHoles) {
26560
26749
  holes.push(
26561
- { x: halfBoardWidth, y: -y },
26562
- { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }
26750
+ { x: -halfBoardWidth, y: -y },
26751
+ { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }
26563
26752
  );
26564
26753
  }
26565
26754
  }
@@ -26571,14 +26760,14 @@ var StampBoard = ({
26571
26760
  pads.push({
26572
26761
  x: -x,
26573
26762
  // Flip x
26574
- y: -bodyLength10 / 2 + leadLength / 2,
26763
+ y: bodyLength10 / 2 - leadLength / 2,
26575
26764
  pl: leadWidth,
26576
26765
  pw: leadLength
26577
26766
  });
26578
26767
  if (innerHoles) {
26579
26768
  holes.push(
26580
- { x: -x, y: -bodyLength10 / 2 },
26581
- { x: -x, y: -bodyLength10 / 2 + innerHoleEdgeDistance }
26769
+ { x: -x, y: bodyLength10 / 2 },
26770
+ { x: -x, y: bodyLength10 / 2 - innerHoleEdgeDistance }
26582
26771
  );
26583
26772
  }
26584
26773
  }
@@ -26590,14 +26779,14 @@ var StampBoard = ({
26590
26779
  pads.push({
26591
26780
  x: -x,
26592
26781
  // Flip x
26593
- y: bodyLength10 / 2 - leadLength / 2,
26782
+ y: -bodyLength10 / 2 + leadLength / 2,
26594
26783
  pl: leadWidth,
26595
26784
  pw: leadLength
26596
26785
  });
26597
26786
  if (innerHoles) {
26598
26787
  holes.push(
26599
- { x: -x, y: bodyLength10 / 2 },
26600
- { x: -x, y: bodyLength10 / 2 - innerHoleEdgeDistance }
26788
+ { x: -x, y: -bodyLength10 / 2 },
26789
+ { x: -x, y: -bodyLength10 / 2 + innerHoleEdgeDistance }
26601
26790
  );
26602
26791
  }
26603
26792
  }
@@ -26652,6 +26841,66 @@ var StampBoard = ({
26652
26841
  ] }) : rectPads })
26653
26842
  ] });
26654
26843
  };
26844
+ var Screen = ({
26845
+ width: width10 = 30,
26846
+ height: height10 = 22,
26847
+ thickness = 1,
26848
+ bezelInset = 2,
26849
+ bezelDepth = 1,
26850
+ screenColor = "#001414",
26851
+ bezelColor = "#0f1116",
26852
+ screenWidth,
26853
+ screenHeight,
26854
+ offset: offset4
26855
+ }) => {
26856
+ const w = width10;
26857
+ const h2 = height10;
26858
+ const stackHeight = Math.max(thickness, 0.4);
26859
+ const clampedBezelDepth = Math.max(Math.min(bezelDepth, stackHeight), 0.2);
26860
+ const backBlockHeight = Math.max(stackHeight - clampedBezelDepth, 0);
26861
+ const inset = Math.max(bezelInset, 0);
26862
+ const innerWidth = Math.max(screenWidth ?? w - inset * 2, 2);
26863
+ const innerHeight = Math.max(screenHeight ?? h2 - inset * 2, 2);
26864
+ const screenThickness = Math.min(
26865
+ Math.max(clampedBezelDepth * 0.6, 0.2),
26866
+ clampedBezelDepth
26867
+ );
26868
+ const offsetX = offset4?.x ?? 0;
26869
+ const offsetY = offset4?.y ?? 0;
26870
+ const offsetZ = offset4?.z ?? 0;
26871
+ return /* @__PURE__ */ jsxs(Translate, { offset: { x: offsetX, y: offsetY, z: offsetZ }, children: [
26872
+ backBlockHeight > 0 && /* @__PURE__ */ jsx2(Colorize, { color: bezelColor, children: /* @__PURE__ */ jsx2(
26873
+ Cuboid,
26874
+ {
26875
+ size: [w, h2, backBlockHeight],
26876
+ offset: [0, 0, backBlockHeight / 2]
26877
+ }
26878
+ ) }),
26879
+ /* @__PURE__ */ jsx2(Colorize, { color: bezelColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
26880
+ /* @__PURE__ */ jsx2(
26881
+ Cuboid,
26882
+ {
26883
+ size: [w, h2, clampedBezelDepth],
26884
+ offset: [0, 0, backBlockHeight + clampedBezelDepth / 2]
26885
+ }
26886
+ ),
26887
+ /* @__PURE__ */ jsx2(
26888
+ Cuboid,
26889
+ {
26890
+ size: [innerWidth, innerHeight, clampedBezelDepth + 0.02],
26891
+ offset: [0, 0, backBlockHeight + clampedBezelDepth / 2]
26892
+ }
26893
+ )
26894
+ ] }) }),
26895
+ /* @__PURE__ */ jsx2(Colorize, { color: screenColor, children: /* @__PURE__ */ jsx2(
26896
+ Cuboid,
26897
+ {
26898
+ size: [innerWidth, innerHeight, screenThickness],
26899
+ offset: [0, 0, backBlockHeight + screenThickness / 2]
26900
+ }
26901
+ ) })
26902
+ ] });
26903
+ };
26655
26904
  var MountedPcbModule = ({
26656
26905
  numPins = 5,
26657
26906
  rows = 1,
@@ -26665,8 +26914,15 @@ var MountedPcbModule = ({
26665
26914
  holes = [],
26666
26915
  holeInset = 1,
26667
26916
  pinRowHoleEdgeToEdgeDist = 2,
26668
- nopin
26917
+ female,
26918
+ nopin,
26919
+ screen,
26920
+ screenWidth,
26921
+ screenHeight,
26922
+ screenCenterOffsetX,
26923
+ screenCenterOffsetY
26669
26924
  }) => {
26925
+ const showScreen = screen ?? false;
26670
26926
  const boardCenterZ = boardThickness / 2;
26671
26927
  const numPinsPerRow = Math.ceil(numPins / rows);
26672
26928
  let calculatedWidth;
@@ -26743,7 +26999,8 @@ var MountedPcbModule = ({
26743
26999
  const pinBodyHeight = 2;
26744
27000
  const longSidePinLength = 6;
26745
27001
  const shortSidePinLength = 3;
26746
- const boardOffsetZ = nopin ? 0 : pinBodyHeight;
27002
+ const boardOffsetZ = nopin || female ? 0 : pinBodyHeight;
27003
+ const boardTopZ = boardOffsetZ + boardThickness;
26747
27004
  const boardBody = /* @__PURE__ */ jsx2(Colorize, { color: "#008080", children: /* @__PURE__ */ jsxs(Subtract, { children: [
26748
27005
  /* @__PURE__ */ jsx2(
26749
27006
  Cuboid,
@@ -26802,10 +27059,32 @@ var MountedPcbModule = ({
26802
27059
  },
26803
27060
  `pin-3d-${index2}`
26804
27061
  ));
27062
+ const femaleHeaderRow = pins.map((pin, index2) => /* @__PURE__ */ jsx2(
27063
+ FemaleHeader,
27064
+ {
27065
+ x: pin.x,
27066
+ y: pin.y,
27067
+ flipZ: (z18) => -z18
27068
+ },
27069
+ `female-pin-3d-${index2}`
27070
+ ));
26805
27071
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
26806
27072
  boardBody,
26807
27073
  platedHoles,
26808
- !nopin && headerPins
27074
+ !female && !nopin && headerPins,
27075
+ female && femaleHeaderRow,
27076
+ showScreen && /* @__PURE__ */ jsx2(
27077
+ Screen,
27078
+ {
27079
+ width: screenWidth ?? finalWidth * 0.8,
27080
+ height: screenHeight ?? finalHeight * 0.6,
27081
+ offset: {
27082
+ x: screenCenterOffsetX ?? 0,
27083
+ y: screenCenterOffsetY ?? 0,
27084
+ z: boardTopZ
27085
+ }
27086
+ }
27087
+ )
26809
27088
  ] });
26810
27089
  };
26811
27090
  var Footprinter3d = ({ footprint }) => {
@@ -27086,7 +27365,13 @@ var Footprinter3d = ({ footprint }) => {
27086
27365
  holes,
27087
27366
  holeInset,
27088
27367
  pinRowHoleEdgeToEdgeDist,
27089
- nopin: fpJson.nopin
27368
+ nopin: fpJson.nopin,
27369
+ female: fpJson.female,
27370
+ screen: fpJson.screen,
27371
+ screenWidth: fpJson.screenwidth,
27372
+ screenHeight: fpJson.screenheight,
27373
+ screenCenterOffsetX: fpJson.screencenteroffsetx,
27374
+ screenCenterOffsetY: fpJson.screencenteroffsety
27090
27375
  }
27091
27376
  );
27092
27377
  }
@@ -28483,7 +28768,7 @@ import * as THREE16 from "three";
28483
28768
  // package.json
28484
28769
  var package_default = {
28485
28770
  name: "@tscircuit/3d-viewer",
28486
- version: "0.0.523",
28771
+ version: "0.0.525",
28487
28772
  main: "./dist/index.js",
28488
28773
  module: "./dist/index.js",
28489
28774
  type: "module",
@@ -28513,7 +28798,7 @@ var package_default = {
28513
28798
  "@jscad/regl-renderer": "^2.6.12",
28514
28799
  "@jscad/stl-serializer": "^2.1.20",
28515
28800
  "circuit-json": "^0.0.372",
28516
- "circuit-to-canvas": "^0.0.81",
28801
+ "circuit-to-canvas": "^0.0.83",
28517
28802
  "react-hot-toast": "^2.6.0",
28518
28803
  three: "^0.165.0",
28519
28804
  "three-stdlib": "^2.36.0",
@@ -28543,7 +28828,7 @@ var package_default = {
28543
28828
  "bun-match-svg": "^0.0.9",
28544
28829
  "bun-types": "1.2.1",
28545
28830
  debug: "^4.4.0",
28546
- "jscad-electronics": "^0.0.118",
28831
+ "jscad-electronics": "^0.0.123",
28547
28832
  "jscad-planner": "^0.0.13",
28548
28833
  jsdom: "^26.0.0",
28549
28834
  "manifold-3d": "^3.2.1",
@@ -31452,7 +31737,7 @@ import { su as su8 } from "@tscircuit/circuit-json-util";
31452
31737
  import { useEffect as useEffect23, useMemo as useMemo19 } from "react";
31453
31738
 
31454
31739
  // src/textures/create-combined-board-textures.ts
31455
- import * as THREE28 from "three";
31740
+ import * as THREE27 from "three";
31456
31741
 
31457
31742
  // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
31458
31743
  var getBoundsFromPoints = (points) => {
@@ -31948,227 +32233,11 @@ function createCopperTextTextureForLayer({
31948
32233
  return texture;
31949
32234
  }
31950
32235
 
31951
- // src/textures/create-copper-pour-texture-for-layer.ts
31952
- import * as THREE23 from "three";
31953
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer2 } from "circuit-to-canvas";
31954
-
31955
- // src/geoms/brep-converter.ts
31956
- var import_primitives7 = __toESM(require_primitives(), 1);
31957
- var import_booleans5 = __toESM(require_booleans(), 1);
31958
- function segmentToPoints(p1, p2, bulge, arcSegments) {
31959
- if (!bulge || Math.abs(bulge) < 1e-9) {
31960
- return [];
31961
- }
31962
- const theta = 4 * Math.atan(bulge);
31963
- const dx = p2[0] - p1[0];
31964
- const dy = p2[1] - p1[1];
31965
- const dist = Math.sqrt(dx * dx + dy * dy);
31966
- if (dist < 1e-9) return [];
31967
- const radius = Math.abs(dist / (2 * Math.sin(theta / 2)));
31968
- const m = Math.sqrt(Math.max(0, radius * radius - dist / 2 * (dist / 2)));
31969
- const midPoint = [(p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2];
31970
- const ux = dx / dist;
31971
- const uy = dy / dist;
31972
- const nx = -uy;
31973
- const ny = ux;
31974
- const centerX = midPoint[0] + nx * m * Math.sign(bulge);
31975
- const centerY = midPoint[1] + ny * m * Math.sign(bulge);
31976
- const startAngle = Math.atan2(p1[1] - centerY, p1[0] - centerX);
31977
- const points = [];
31978
- const numSteps = Math.max(
31979
- 2,
31980
- Math.ceil(arcSegments * Math.abs(theta) / (Math.PI * 2) * 4)
31981
- );
31982
- const angleStep = theta / numSteps;
31983
- for (let i = 1; i < numSteps; i++) {
31984
- const angle = startAngle + angleStep * i;
31985
- points.push([
31986
- centerX + radius * Math.cos(angle),
31987
- centerY + radius * Math.sin(angle)
31988
- ]);
31989
- }
31990
- return points;
31991
- }
31992
- function ringToPoints(ring, arcSegments) {
31993
- const allPoints = [];
31994
- const vertices = ring.vertices;
31995
- for (let i = 0; i < vertices.length; i++) {
31996
- const p1 = vertices[i];
31997
- const p2 = vertices[(i + 1) % vertices.length];
31998
- allPoints.push([p1.x, p1.y]);
31999
- if (p1.bulge) {
32000
- const arcPoints = segmentToPoints(
32001
- [p1.x, p1.y],
32002
- [p2.x, p2.y],
32003
- p1.bulge,
32004
- arcSegments
32005
- );
32006
- allPoints.push(...arcPoints);
32007
- }
32008
- }
32009
- return allPoints;
32010
- }
32011
-
32012
- // src/textures/create-copper-pour-texture-for-layer.ts
32013
- function drawPolygon({
32014
- ctx,
32015
- points,
32016
- canvasXFromPcb,
32017
- canvasYFromPcb
32018
- }) {
32019
- if (points.length < 3) return;
32020
- ctx.beginPath();
32021
- points.forEach((point, index2) => {
32022
- const canvasX = canvasXFromPcb(point[0]);
32023
- const canvasY = canvasYFromPcb(point[1]);
32024
- if (index2 === 0) {
32025
- ctx.moveTo(canvasX, canvasY);
32026
- } else {
32027
- ctx.lineTo(canvasX, canvasY);
32028
- }
32029
- });
32030
- ctx.closePath();
32031
- ctx.fill();
32032
- }
32033
- function drawBrepShape({
32034
- ctx,
32035
- pour,
32036
- canvasXFromPcb,
32037
- canvasYFromPcb
32038
- }) {
32039
- const brepShape = pour.brep_shape;
32040
- if (!brepShape || !brepShape.outer_ring) return;
32041
- const outerRingPoints = ringToPoints(brepShape.outer_ring, 32);
32042
- if (outerRingPoints.length >= 3) {
32043
- drawPolygon({
32044
- ctx,
32045
- points: outerRingPoints,
32046
- canvasXFromPcb,
32047
- canvasYFromPcb
32048
- });
32049
- }
32050
- if (brepShape.inner_rings && brepShape.inner_rings.length > 0) {
32051
- ctx.globalCompositeOperation = "destination-out";
32052
- for (const innerRing of brepShape.inner_rings) {
32053
- const innerRingPoints = ringToPoints(innerRing, 32);
32054
- if (innerRingPoints.length >= 3) {
32055
- drawPolygon({
32056
- ctx,
32057
- points: innerRingPoints,
32058
- canvasXFromPcb,
32059
- canvasYFromPcb
32060
- });
32061
- }
32062
- }
32063
- ctx.globalCompositeOperation = "source-over";
32064
- }
32065
- }
32066
- function createCopperPourTextureForLayer({
32067
- layer,
32068
- circuitJson,
32069
- boardData,
32070
- traceTextureResolution = TRACE_TEXTURE_RESOLUTION
32071
- }) {
32072
- const copperPours = circuitJson.filter(
32073
- (e) => e.type === "pcb_copper_pour"
32074
- );
32075
- const pcbRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
32076
- const poursOnLayer = copperPours.filter((p) => p.layer === layer);
32077
- if (poursOnLayer.length === 0) return null;
32078
- const boardOutlineBounds = calculateOutlineBounds(boardData);
32079
- const canvas = document.createElement("canvas");
32080
- const canvasWidth = Math.floor(
32081
- boardOutlineBounds.width * traceTextureResolution
32082
- );
32083
- const canvasHeight = Math.floor(
32084
- boardOutlineBounds.height * traceTextureResolution
32085
- );
32086
- canvas.width = canvasWidth;
32087
- canvas.height = canvasHeight;
32088
- const ctx = canvas.getContext("2d");
32089
- if (!ctx) return null;
32090
- if (layer === "bottom") {
32091
- ctx.translate(0, canvasHeight);
32092
- ctx.scale(1, -1);
32093
- }
32094
- const canvasXFromPcb = (pcbX) => (pcbX - boardOutlineBounds.minX) * traceTextureResolution;
32095
- const canvasYFromPcb = (pcbY) => (boardOutlineBounds.maxY - pcbY) * traceTextureResolution;
32096
- const rectAndPolygonPours = poursOnLayer.filter(
32097
- (pour) => pour.shape === "rect" || pour.shape === "polygon"
32098
- );
32099
- const brepPours = poursOnLayer.filter((pour) => pour.shape === "brep");
32100
- if (rectAndPolygonPours.length > 0) {
32101
- const drawer = new CircuitToCanvasDrawer2(ctx);
32102
- drawer.setCameraBounds({
32103
- minX: boardOutlineBounds.minX,
32104
- maxX: boardOutlineBounds.maxX,
32105
- minY: boardOutlineBounds.minY,
32106
- maxY: boardOutlineBounds.maxY
32107
- });
32108
- const coveredPours = rectAndPolygonPours.filter(
32109
- (p) => p.covered_with_solder_mask !== false
32110
- );
32111
- const uncoveredPours = rectAndPolygonPours.filter(
32112
- (p) => p.covered_with_solder_mask === false
32113
- );
32114
- const coveredColor = `rgb(${colors.fr4TracesWithMaskGreen.map((c) => c * 255).join(",")})`;
32115
- const uncoveredColor = `rgb(${colors.copper.map((c) => c * 255).join(",")})`;
32116
- if (coveredPours.length > 0) {
32117
- drawer.configure({
32118
- colorOverrides: {
32119
- copper: {
32120
- top: coveredColor,
32121
- bottom: coveredColor,
32122
- inner1: coveredColor,
32123
- inner2: coveredColor,
32124
- inner3: coveredColor,
32125
- inner4: coveredColor,
32126
- inner5: coveredColor,
32127
- inner6: coveredColor
32128
- }
32129
- }
32130
- });
32131
- drawer.drawElements(coveredPours, { layers: [pcbRenderLayer] });
32132
- }
32133
- if (uncoveredPours.length > 0) {
32134
- drawer.configure({
32135
- colorOverrides: {
32136
- copper: {
32137
- top: uncoveredColor,
32138
- bottom: uncoveredColor,
32139
- inner1: uncoveredColor,
32140
- inner2: uncoveredColor,
32141
- inner3: uncoveredColor,
32142
- inner4: uncoveredColor,
32143
- inner5: uncoveredColor,
32144
- inner6: uncoveredColor
32145
- }
32146
- }
32147
- });
32148
- drawer.drawElements(uncoveredPours, { layers: [pcbRenderLayer] });
32149
- }
32150
- }
32151
- for (const pour of brepPours) {
32152
- const covered = pour.covered_with_solder_mask !== false;
32153
- const colorArr = covered ? colors.fr4TracesWithMaskGreen : colors.copper;
32154
- const copperColor = `rgb(${colorArr[0] * 255}, ${colorArr[1] * 255}, ${colorArr[2] * 255})`;
32155
- ctx.fillStyle = copperColor;
32156
- drawBrepShape({ ctx, pour, canvasXFromPcb, canvasYFromPcb });
32157
- }
32158
- const texture = new THREE23.CanvasTexture(canvas);
32159
- texture.generateMipmaps = true;
32160
- texture.minFilter = THREE23.LinearMipmapLinearFilter;
32161
- texture.magFilter = THREE23.LinearFilter;
32162
- texture.anisotropy = 16;
32163
- texture.needsUpdate = true;
32164
- return texture;
32165
- }
32166
-
32167
32236
  // src/textures/create-fabrication-note-texture-for-layer.ts
32168
- import * as THREE24 from "three";
32237
+ import * as THREE23 from "three";
32169
32238
 
32170
32239
  // src/textures/fabrication-note/fabrication-note-drawing.ts
32171
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
32240
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer2 } from "circuit-to-canvas";
32172
32241
 
32173
32242
  // src/utils/units.ts
32174
32243
  var MM_PER_INCH = 25.4;
@@ -32266,7 +32335,7 @@ var drawFabricationNoteLayer = ({
32266
32335
  }) => {
32267
32336
  const renderLayer = `${layer}_fabrication_note`;
32268
32337
  const normalizedElements = elements.map(normalizeFabricationElement);
32269
- const drawer = new CircuitToCanvasDrawer3(ctx);
32338
+ const drawer = new CircuitToCanvasDrawer2(ctx);
32270
32339
  drawer.configure({
32271
32340
  colorOverrides: {
32272
32341
  copper: {
@@ -32392,20 +32461,20 @@ function createFabricationNoteTextureForLayer({
32392
32461
  bounds,
32393
32462
  elements
32394
32463
  });
32395
- const texture = new THREE24.CanvasTexture(canvas);
32464
+ const texture = new THREE23.CanvasTexture(canvas);
32396
32465
  texture.generateMipmaps = true;
32397
- texture.minFilter = THREE24.LinearMipmapLinearFilter;
32398
- texture.magFilter = THREE24.LinearFilter;
32466
+ texture.minFilter = THREE23.LinearMipmapLinearFilter;
32467
+ texture.magFilter = THREE23.LinearFilter;
32399
32468
  texture.anisotropy = 16;
32400
32469
  texture.needsUpdate = true;
32401
32470
  return texture;
32402
32471
  }
32403
32472
 
32404
32473
  // src/textures/create-pcb-note-texture-for-layer.ts
32405
- import * as THREE25 from "three";
32474
+ import * as THREE24 from "three";
32406
32475
 
32407
32476
  // src/textures/pcb-note/pcb-note-drawing.ts
32408
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
32477
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
32409
32478
  var TRANSPARENT2 = "rgba(0,0,0,0)";
32410
32479
  var setDrawerBounds3 = (drawer, bounds) => {
32411
32480
  drawer.setCameraBounds({
@@ -32484,7 +32553,7 @@ var drawPcbNoteLayer = ({
32484
32553
  elements
32485
32554
  }) => {
32486
32555
  const normalizedElements = elements.map(normalizePcbNoteElement);
32487
- const drawer = new CircuitToCanvasDrawer4(ctx);
32556
+ const drawer = new CircuitToCanvasDrawer3(ctx);
32488
32557
  drawer.configure({
32489
32558
  colorOverrides: {
32490
32559
  copper: {
@@ -32553,20 +32622,20 @@ function createPcbNoteTextureForLayer({
32553
32622
  bounds,
32554
32623
  elements
32555
32624
  });
32556
- const texture = new THREE25.CanvasTexture(canvas);
32625
+ const texture = new THREE24.CanvasTexture(canvas);
32557
32626
  texture.generateMipmaps = true;
32558
- texture.minFilter = THREE25.LinearMipmapLinearFilter;
32559
- texture.magFilter = THREE25.LinearFilter;
32627
+ texture.minFilter = THREE24.LinearMipmapLinearFilter;
32628
+ texture.magFilter = THREE24.LinearFilter;
32560
32629
  texture.anisotropy = 16;
32561
32630
  texture.needsUpdate = true;
32562
32631
  return texture;
32563
32632
  }
32564
32633
 
32565
32634
  // src/textures/create-silkscreen-texture-for-layer.ts
32566
- import * as THREE26 from "three";
32635
+ import * as THREE25 from "three";
32567
32636
 
32568
32637
  // src/textures/silkscreen/silkscreen-drawing.ts
32569
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
32638
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
32570
32639
  var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
32571
32640
  var TRANSPARENT3 = "rgba(0,0,0,0)";
32572
32641
  var setDrawerBounds4 = (drawer, bounds) => {
@@ -32585,7 +32654,7 @@ var drawSilkscreenLayer = ({
32585
32654
  silkscreenColor
32586
32655
  }) => {
32587
32656
  const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
32588
- const drawer = new CircuitToCanvasDrawer5(ctx);
32657
+ const drawer = new CircuitToCanvasDrawer4(ctx);
32589
32658
  drawer.configure({
32590
32659
  colorOverrides: {
32591
32660
  copper: {
@@ -32672,20 +32741,20 @@ function createSilkscreenTextureForLayer({
32672
32741
  elements,
32673
32742
  silkscreenColor
32674
32743
  });
32675
- const texture = new THREE26.CanvasTexture(canvas);
32744
+ const texture = new THREE25.CanvasTexture(canvas);
32676
32745
  texture.generateMipmaps = true;
32677
- texture.minFilter = THREE26.LinearMipmapLinearFilter;
32678
- texture.magFilter = THREE26.LinearFilter;
32746
+ texture.minFilter = THREE25.LinearMipmapLinearFilter;
32747
+ texture.magFilter = THREE25.LinearFilter;
32679
32748
  texture.anisotropy = 16;
32680
32749
  texture.needsUpdate = true;
32681
32750
  return texture;
32682
32751
  }
32683
32752
 
32684
32753
  // src/textures/create-soldermask-texture-for-layer.ts
32685
- import * as THREE27 from "three";
32754
+ import * as THREE26 from "three";
32686
32755
 
32687
32756
  // src/textures/soldermask/soldermask-drawing.ts
32688
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
32757
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
32689
32758
  var toRgb = (colorArr) => {
32690
32759
  const [r = 0, g = 0, b = 0] = colorArr;
32691
32760
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -32721,7 +32790,7 @@ var drawSoldermaskLayer = ({
32721
32790
  }) => {
32722
32791
  const palette = getSoldermaskPalette(boardMaterial);
32723
32792
  const copperRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
32724
- const drawer = new CircuitToCanvasDrawer6(ctx);
32793
+ const drawer = new CircuitToCanvasDrawer5(ctx);
32725
32794
  drawer.configure({
32726
32795
  colorOverrides: {
32727
32796
  copper: {
@@ -32765,7 +32834,7 @@ var drawSoldermaskLayer = ({
32765
32834
  if (uncoveredPours.length > 0) {
32766
32835
  ctx.save();
32767
32836
  ctx.globalCompositeOperation = "destination-out";
32768
- const cutoutDrawer = new CircuitToCanvasDrawer6(ctx);
32837
+ const cutoutDrawer = new CircuitToCanvasDrawer5(ctx);
32769
32838
  cutoutDrawer.configure({
32770
32839
  colorOverrides: {
32771
32840
  copper: {
@@ -32814,10 +32883,10 @@ function createSoldermaskTextureForLayer({
32814
32883
  elements,
32815
32884
  boardMaterial: boardData.material
32816
32885
  });
32817
- const texture = new THREE27.CanvasTexture(canvas);
32886
+ const texture = new THREE26.CanvasTexture(canvas);
32818
32887
  texture.generateMipmaps = true;
32819
- texture.minFilter = THREE27.LinearMipmapLinearFilter;
32820
- texture.magFilter = THREE27.LinearFilter;
32888
+ texture.minFilter = THREE26.LinearMipmapLinearFilter;
32889
+ texture.magFilter = THREE26.LinearFilter;
32821
32890
  texture.anisotropy = 16;
32822
32891
  texture.needsUpdate = true;
32823
32892
  return texture;
@@ -32855,10 +32924,10 @@ var createCombinedTexture = ({
32855
32924
  const image = texture.image;
32856
32925
  ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
32857
32926
  });
32858
- const combinedTexture = new THREE28.CanvasTexture(canvas);
32927
+ const combinedTexture = new THREE27.CanvasTexture(canvas);
32859
32928
  combinedTexture.generateMipmaps = false;
32860
- combinedTexture.minFilter = THREE28.LinearFilter;
32861
- combinedTexture.magFilter = THREE28.LinearFilter;
32929
+ combinedTexture.minFilter = THREE27.LinearFilter;
32930
+ combinedTexture.magFilter = THREE27.LinearFilter;
32862
32931
  combinedTexture.premultiplyAlpha = true;
32863
32932
  combinedTexture.anisotropy = 16;
32864
32933
  combinedTexture.needsUpdate = true;
@@ -32899,12 +32968,6 @@ function createCombinedBoardTextures({
32899
32968
  copperColor,
32900
32969
  traceTextureResolution
32901
32970
  }) : null;
32902
- const copperPourTexture = showCopper ? createCopperPourTextureForLayer({
32903
- layer,
32904
- circuitJson,
32905
- boardData,
32906
- traceTextureResolution
32907
- }) : null;
32908
32971
  const padTexture = showCopper ? createPadTextureForLayer({
32909
32972
  layer,
32910
32973
  circuitJson,
@@ -32939,7 +33002,6 @@ function createCombinedBoardTextures({
32939
33002
  }) : null;
32940
33003
  return createCombinedTexture({
32941
33004
  textures: [
32942
- copperPourTexture,
32943
33005
  traceTexture,
32944
33006
  padTexture,
32945
33007
  soldermaskTexture,
@@ -32960,6 +33022,14 @@ function createCombinedBoardTextures({
32960
33022
  };
32961
33023
  }
32962
33024
 
33025
+ // src/textures/create-copper-pour-texture-for-layer.ts
33026
+ import * as THREE28 from "three";
33027
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
33028
+
33029
+ // src/geoms/brep-converter.ts
33030
+ var import_primitives7 = __toESM(require_primitives(), 1);
33031
+ var import_booleans5 = __toESM(require_booleans(), 1);
33032
+
32963
33033
  // src/textures/create-three-texture-meshes.ts
32964
33034
  import * as THREE29 from "three";
32965
33035
  function createTexturePlane(config, boardData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.524",
3
+ "version": "0.0.526",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "@jscad/regl-renderer": "^2.6.12",
31
31
  "@jscad/stl-serializer": "^2.1.20",
32
32
  "circuit-json": "^0.0.372",
33
- "circuit-to-canvas": "^0.0.81",
33
+ "circuit-to-canvas": "^0.0.83",
34
34
  "react-hot-toast": "^2.6.0",
35
35
  "three": "^0.165.0",
36
36
  "three-stdlib": "^2.36.0",
@@ -60,7 +60,7 @@
60
60
  "bun-match-svg": "^0.0.9",
61
61
  "bun-types": "1.2.1",
62
62
  "debug": "^4.4.0",
63
- "jscad-electronics": "^0.0.118",
63
+ "jscad-electronics": "^0.0.123",
64
64
  "jscad-planner": "^0.0.13",
65
65
  "jsdom": "^26.0.0",
66
66
  "manifold-3d": "^3.2.1",