@tscircuit/3d-viewer 0.0.524 → 0.0.525

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 +381 -96
  2. package/package.json +2 -2
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.524",
28487
28772
  main: "./dist/index.js",
28488
28773
  module: "./dist/index.js",
28489
28774
  type: "module",
@@ -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",
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.525",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -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",