@tscircuit/3d-viewer 0.0.200 → 0.0.202
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 +524 -257
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -195,9 +195,9 @@ var require_trigonometry = __commonJS({
|
|
|
195
195
|
"use strict";
|
|
196
196
|
var { NEPS } = require_constants();
|
|
197
197
|
var rezero = (n) => Math.abs(n) < NEPS ? 0 : n;
|
|
198
|
-
var
|
|
199
|
-
var
|
|
200
|
-
module.exports = { sin, cos };
|
|
198
|
+
var sin2 = (radians) => rezero(Math.sin(radians));
|
|
199
|
+
var cos2 = (radians) => rezero(Math.cos(radians));
|
|
200
|
+
module.exports = { sin: sin2, cos: cos2 };
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
|
|
@@ -205,10 +205,10 @@ var require_trigonometry = __commonJS({
|
|
|
205
205
|
var require_fromAngleRadians = __commonJS({
|
|
206
206
|
"node_modules/@jscad/modeling/src/maths/vec2/fromAngleRadians.js"(exports, module) {
|
|
207
207
|
"use strict";
|
|
208
|
-
var { sin, cos } = require_trigonometry();
|
|
208
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
209
209
|
var fromAngleRadians = (out, radians) => {
|
|
210
|
-
out[0] =
|
|
211
|
-
out[1] =
|
|
210
|
+
out[0] = cos2(radians);
|
|
211
|
+
out[1] = sin2(radians);
|
|
212
212
|
return out;
|
|
213
213
|
};
|
|
214
214
|
module.exports = fromAngleRadians;
|
|
@@ -333,7 +333,7 @@ var require_negate = __commonJS({
|
|
|
333
333
|
var require_rotate = __commonJS({
|
|
334
334
|
"node_modules/@jscad/modeling/src/maths/vec2/rotate.js"(exports, module) {
|
|
335
335
|
"use strict";
|
|
336
|
-
var
|
|
336
|
+
var rotate2 = (out, vector, origin, radians) => {
|
|
337
337
|
const x = vector[0] - origin[0];
|
|
338
338
|
const y = vector[1] - origin[1];
|
|
339
339
|
const c = Math.cos(radians);
|
|
@@ -342,7 +342,7 @@ var require_rotate = __commonJS({
|
|
|
342
342
|
out[1] = x * s + y * c + origin[1];
|
|
343
343
|
return out;
|
|
344
344
|
};
|
|
345
|
-
module.exports =
|
|
345
|
+
module.exports = rotate2;
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
348
|
|
|
@@ -352,8 +352,8 @@ var require_normal = __commonJS({
|
|
|
352
352
|
"use strict";
|
|
353
353
|
var { TAU } = require_constants();
|
|
354
354
|
var create = require_create();
|
|
355
|
-
var
|
|
356
|
-
var normal = (out, vector) =>
|
|
355
|
+
var rotate2 = require_rotate();
|
|
356
|
+
var normal = (out, vector) => rotate2(out, vector, create(), TAU / 4);
|
|
357
357
|
module.exports = normal;
|
|
358
358
|
}
|
|
359
359
|
});
|
|
@@ -381,12 +381,12 @@ var require_normalize = __commonJS({
|
|
|
381
381
|
var require_scale = __commonJS({
|
|
382
382
|
"node_modules/@jscad/modeling/src/maths/vec2/scale.js"(exports, module) {
|
|
383
383
|
"use strict";
|
|
384
|
-
var
|
|
384
|
+
var scale2 = (out, vector, amount) => {
|
|
385
385
|
out[0] = vector[0] * amount;
|
|
386
386
|
out[1] = vector[1] * amount;
|
|
387
387
|
return out;
|
|
388
388
|
};
|
|
389
|
-
module.exports =
|
|
389
|
+
module.exports = scale2;
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
392
|
|
|
@@ -455,14 +455,14 @@ var require_toString = __commonJS({
|
|
|
455
455
|
var require_transform = __commonJS({
|
|
456
456
|
"node_modules/@jscad/modeling/src/maths/vec2/transform.js"(exports, module) {
|
|
457
457
|
"use strict";
|
|
458
|
-
var
|
|
458
|
+
var transform2 = (out, vector, matrix) => {
|
|
459
459
|
const x = vector[0];
|
|
460
460
|
const y = vector[1];
|
|
461
461
|
out[0] = matrix[0] * x + matrix[4] * y + matrix[12];
|
|
462
462
|
out[1] = matrix[1] * x + matrix[5] * y + matrix[13];
|
|
463
463
|
return out;
|
|
464
464
|
};
|
|
465
|
-
module.exports =
|
|
465
|
+
module.exports = transform2;
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
468
|
|
|
@@ -754,7 +754,7 @@ var require_fromRotation = __commonJS({
|
|
|
754
754
|
"node_modules/@jscad/modeling/src/maths/mat4/fromRotation.js"(exports, module) {
|
|
755
755
|
"use strict";
|
|
756
756
|
var { EPS } = require_constants();
|
|
757
|
-
var { sin, cos } = require_trigonometry();
|
|
757
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
758
758
|
var identity = require_identity();
|
|
759
759
|
var fromRotation = (out, rad, axis) => {
|
|
760
760
|
let [x, y, z] = axis;
|
|
@@ -766,8 +766,8 @@ var require_fromRotation = __commonJS({
|
|
|
766
766
|
x *= len;
|
|
767
767
|
y *= len;
|
|
768
768
|
z *= len;
|
|
769
|
-
const s =
|
|
770
|
-
const c =
|
|
769
|
+
const s = sin2(rad);
|
|
770
|
+
const c = cos2(rad);
|
|
771
771
|
const t = 1 - c;
|
|
772
772
|
out[0] = x * x * t + c;
|
|
773
773
|
out[1] = y * x * t + z * s;
|
|
@@ -822,14 +822,14 @@ var require_fromScaling = __commonJS({
|
|
|
822
822
|
var require_fromTaitBryanRotation = __commonJS({
|
|
823
823
|
"node_modules/@jscad/modeling/src/maths/mat4/fromTaitBryanRotation.js"(exports, module) {
|
|
824
824
|
"use strict";
|
|
825
|
-
var { sin, cos } = require_trigonometry();
|
|
825
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
826
826
|
var fromTaitBryanRotation = (out, yaw, pitch, roll) => {
|
|
827
|
-
const sy =
|
|
828
|
-
const cy =
|
|
829
|
-
const sp =
|
|
830
|
-
const cp =
|
|
831
|
-
const sr =
|
|
832
|
-
const cr =
|
|
827
|
+
const sy = sin2(yaw);
|
|
828
|
+
const cy = cos2(yaw);
|
|
829
|
+
const sp = sin2(pitch);
|
|
830
|
+
const cp = cos2(pitch);
|
|
831
|
+
const sr = sin2(roll);
|
|
832
|
+
const cr = cos2(roll);
|
|
833
833
|
out[0] = cp * cy;
|
|
834
834
|
out[1] = cp * sy;
|
|
835
835
|
out[2] = -sp;
|
|
@@ -1298,13 +1298,13 @@ var require_rotateZ = __commonJS({
|
|
|
1298
1298
|
var require_scale2 = __commonJS({
|
|
1299
1299
|
"node_modules/@jscad/modeling/src/maths/vec3/scale.js"(exports, module) {
|
|
1300
1300
|
"use strict";
|
|
1301
|
-
var
|
|
1301
|
+
var scale2 = (out, vector, amount) => {
|
|
1302
1302
|
out[0] = vector[0] * amount;
|
|
1303
1303
|
out[1] = vector[1] * amount;
|
|
1304
1304
|
out[2] = vector[2] * amount;
|
|
1305
1305
|
return out;
|
|
1306
1306
|
};
|
|
1307
|
-
module.exports =
|
|
1307
|
+
module.exports = scale2;
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
1310
1310
|
|
|
@@ -1377,7 +1377,7 @@ var require_toString2 = __commonJS({
|
|
|
1377
1377
|
var require_transform2 = __commonJS({
|
|
1378
1378
|
"node_modules/@jscad/modeling/src/maths/vec3/transform.js"(exports, module) {
|
|
1379
1379
|
"use strict";
|
|
1380
|
-
var
|
|
1380
|
+
var transform2 = (out, vector, matrix) => {
|
|
1381
1381
|
const x = vector[0];
|
|
1382
1382
|
const y = vector[1];
|
|
1383
1383
|
const z = vector[2];
|
|
@@ -1388,7 +1388,7 @@ var require_transform2 = __commonJS({
|
|
|
1388
1388
|
out[2] = (matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14]) / w;
|
|
1389
1389
|
return out;
|
|
1390
1390
|
};
|
|
1391
|
-
module.exports =
|
|
1391
|
+
module.exports = transform2;
|
|
1392
1392
|
}
|
|
1393
1393
|
});
|
|
1394
1394
|
|
|
@@ -1472,10 +1472,10 @@ var require_fromVectorRotation = __commonJS({
|
|
|
1472
1472
|
var require_fromXRotation = __commonJS({
|
|
1473
1473
|
"node_modules/@jscad/modeling/src/maths/mat4/fromXRotation.js"(exports, module) {
|
|
1474
1474
|
"use strict";
|
|
1475
|
-
var { sin, cos } = require_trigonometry();
|
|
1475
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1476
1476
|
var fromXRotation = (out, radians) => {
|
|
1477
|
-
const s =
|
|
1478
|
-
const c =
|
|
1477
|
+
const s = sin2(radians);
|
|
1478
|
+
const c = cos2(radians);
|
|
1479
1479
|
out[0] = 1;
|
|
1480
1480
|
out[1] = 0;
|
|
1481
1481
|
out[2] = 0;
|
|
@@ -1502,10 +1502,10 @@ var require_fromXRotation = __commonJS({
|
|
|
1502
1502
|
var require_fromYRotation = __commonJS({
|
|
1503
1503
|
"node_modules/@jscad/modeling/src/maths/mat4/fromYRotation.js"(exports, module) {
|
|
1504
1504
|
"use strict";
|
|
1505
|
-
var { sin, cos } = require_trigonometry();
|
|
1505
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1506
1506
|
var fromYRotation = (out, radians) => {
|
|
1507
|
-
const s =
|
|
1508
|
-
const c =
|
|
1507
|
+
const s = sin2(radians);
|
|
1508
|
+
const c = cos2(radians);
|
|
1509
1509
|
out[0] = c;
|
|
1510
1510
|
out[1] = 0;
|
|
1511
1511
|
out[2] = -s;
|
|
@@ -1532,10 +1532,10 @@ var require_fromYRotation = __commonJS({
|
|
|
1532
1532
|
var require_fromZRotation = __commonJS({
|
|
1533
1533
|
"node_modules/@jscad/modeling/src/maths/mat4/fromZRotation.js"(exports, module) {
|
|
1534
1534
|
"use strict";
|
|
1535
|
-
var { sin, cos } = require_trigonometry();
|
|
1535
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1536
1536
|
var fromZRotation = (out, radians) => {
|
|
1537
|
-
const s =
|
|
1538
|
-
const c =
|
|
1537
|
+
const s = sin2(radians);
|
|
1538
|
+
const c = cos2(radians);
|
|
1539
1539
|
out[0] = c;
|
|
1540
1540
|
out[1] = s;
|
|
1541
1541
|
out[2] = 0;
|
|
@@ -1687,9 +1687,9 @@ var require_rotate2 = __commonJS({
|
|
|
1687
1687
|
"node_modules/@jscad/modeling/src/maths/mat4/rotate.js"(exports, module) {
|
|
1688
1688
|
"use strict";
|
|
1689
1689
|
var { EPS } = require_constants();
|
|
1690
|
-
var { sin, cos } = require_trigonometry();
|
|
1690
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1691
1691
|
var copy = require_copy2();
|
|
1692
|
-
var
|
|
1692
|
+
var rotate2 = (out, matrix, radians, axis) => {
|
|
1693
1693
|
let [x, y, z] = axis;
|
|
1694
1694
|
const lengthSquared = x * x + y * y + z * z;
|
|
1695
1695
|
if (Math.abs(lengthSquared) < EPS) {
|
|
@@ -1699,8 +1699,8 @@ var require_rotate2 = __commonJS({
|
|
|
1699
1699
|
x *= len;
|
|
1700
1700
|
y *= len;
|
|
1701
1701
|
z *= len;
|
|
1702
|
-
const s =
|
|
1703
|
-
const c =
|
|
1702
|
+
const s = sin2(radians);
|
|
1703
|
+
const c = cos2(radians);
|
|
1704
1704
|
const t = 1 - c;
|
|
1705
1705
|
const a00 = matrix[0];
|
|
1706
1706
|
const a01 = matrix[1];
|
|
@@ -1743,7 +1743,7 @@ var require_rotate2 = __commonJS({
|
|
|
1743
1743
|
}
|
|
1744
1744
|
return out;
|
|
1745
1745
|
};
|
|
1746
|
-
module.exports =
|
|
1746
|
+
module.exports = rotate2;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
|
|
@@ -1751,10 +1751,10 @@ var require_rotate2 = __commonJS({
|
|
|
1751
1751
|
var require_rotateX2 = __commonJS({
|
|
1752
1752
|
"node_modules/@jscad/modeling/src/maths/mat4/rotateX.js"(exports, module) {
|
|
1753
1753
|
"use strict";
|
|
1754
|
-
var { sin, cos } = require_trigonometry();
|
|
1754
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1755
1755
|
var rotateX = (out, matrix, radians) => {
|
|
1756
|
-
const s =
|
|
1757
|
-
const c =
|
|
1756
|
+
const s = sin2(radians);
|
|
1757
|
+
const c = cos2(radians);
|
|
1758
1758
|
const a10 = matrix[4];
|
|
1759
1759
|
const a11 = matrix[5];
|
|
1760
1760
|
const a12 = matrix[6];
|
|
@@ -1791,10 +1791,10 @@ var require_rotateX2 = __commonJS({
|
|
|
1791
1791
|
var require_rotateY2 = __commonJS({
|
|
1792
1792
|
"node_modules/@jscad/modeling/src/maths/mat4/rotateY.js"(exports, module) {
|
|
1793
1793
|
"use strict";
|
|
1794
|
-
var { sin, cos } = require_trigonometry();
|
|
1794
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1795
1795
|
var rotateY = (out, matrix, radians) => {
|
|
1796
|
-
const s =
|
|
1797
|
-
const c =
|
|
1796
|
+
const s = sin2(radians);
|
|
1797
|
+
const c = cos2(radians);
|
|
1798
1798
|
const a00 = matrix[0];
|
|
1799
1799
|
const a01 = matrix[1];
|
|
1800
1800
|
const a02 = matrix[2];
|
|
@@ -1831,10 +1831,10 @@ var require_rotateY2 = __commonJS({
|
|
|
1831
1831
|
var require_rotateZ2 = __commonJS({
|
|
1832
1832
|
"node_modules/@jscad/modeling/src/maths/mat4/rotateZ.js"(exports, module) {
|
|
1833
1833
|
"use strict";
|
|
1834
|
-
var { sin, cos } = require_trigonometry();
|
|
1834
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
1835
1835
|
var rotateZ = (out, matrix, radians) => {
|
|
1836
|
-
const s =
|
|
1837
|
-
const c =
|
|
1836
|
+
const s = sin2(radians);
|
|
1837
|
+
const c = cos2(radians);
|
|
1838
1838
|
const a00 = matrix[0];
|
|
1839
1839
|
const a01 = matrix[1];
|
|
1840
1840
|
const a02 = matrix[2];
|
|
@@ -1871,7 +1871,7 @@ var require_rotateZ2 = __commonJS({
|
|
|
1871
1871
|
var require_scale3 = __commonJS({
|
|
1872
1872
|
"node_modules/@jscad/modeling/src/maths/mat4/scale.js"(exports, module) {
|
|
1873
1873
|
"use strict";
|
|
1874
|
-
var
|
|
1874
|
+
var scale2 = (out, matrix, dimensions) => {
|
|
1875
1875
|
const x = dimensions[0];
|
|
1876
1876
|
const y = dimensions[1];
|
|
1877
1877
|
const z = dimensions[2];
|
|
@@ -1893,7 +1893,7 @@ var require_scale3 = __commonJS({
|
|
|
1893
1893
|
out[15] = matrix[15];
|
|
1894
1894
|
return out;
|
|
1895
1895
|
};
|
|
1896
|
-
module.exports =
|
|
1896
|
+
module.exports = scale2;
|
|
1897
1897
|
}
|
|
1898
1898
|
});
|
|
1899
1899
|
|
|
@@ -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 translate4 = (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 = translate4;
|
|
1994
1994
|
}
|
|
1995
1995
|
});
|
|
1996
1996
|
|
|
@@ -2515,11 +2515,11 @@ var require_transform3 = __commonJS({
|
|
|
2515
2515
|
"node_modules/@jscad/modeling/src/geometries/path2/transform.js"(exports, module) {
|
|
2516
2516
|
"use strict";
|
|
2517
2517
|
var mat4 = require_mat4();
|
|
2518
|
-
var
|
|
2518
|
+
var transform2 = (matrix, geometry) => {
|
|
2519
2519
|
const transforms = mat4.multiply(mat4.create(), matrix, geometry.transforms);
|
|
2520
2520
|
return Object.assign({}, geometry, { transforms });
|
|
2521
2521
|
};
|
|
2522
|
-
module.exports =
|
|
2522
|
+
module.exports = transform2;
|
|
2523
2523
|
}
|
|
2524
2524
|
});
|
|
2525
2525
|
|
|
@@ -2992,7 +2992,7 @@ var require_transform4 = __commonJS({
|
|
|
2992
2992
|
"use strict";
|
|
2993
2993
|
var mat4 = require_mat4();
|
|
2994
2994
|
var reverse = require_reverse2();
|
|
2995
|
-
var
|
|
2995
|
+
var transform2 = (matrix, geometry) => {
|
|
2996
2996
|
const transforms = mat4.multiply(mat4.create(), matrix, geometry.transforms);
|
|
2997
2997
|
const transformed = Object.assign({}, geometry, { transforms });
|
|
2998
2998
|
if (matrix[0] * matrix[5] - matrix[4] * matrix[1] < 0) {
|
|
@@ -3000,7 +3000,7 @@ var require_transform4 = __commonJS({
|
|
|
3000
3000
|
}
|
|
3001
3001
|
return transformed;
|
|
3002
3002
|
};
|
|
3003
|
-
module.exports =
|
|
3003
|
+
module.exports = transform2;
|
|
3004
3004
|
}
|
|
3005
3005
|
});
|
|
3006
3006
|
|
|
@@ -3058,7 +3058,7 @@ var require_ellipse = __commonJS({
|
|
|
3058
3058
|
var { EPS, TAU } = require_constants();
|
|
3059
3059
|
var vec2 = require_vec2();
|
|
3060
3060
|
var geom2 = require_geom2();
|
|
3061
|
-
var { sin, cos } = require_trigonometry();
|
|
3061
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
3062
3062
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
3063
3063
|
var ellipse = (options) => {
|
|
3064
3064
|
const defaults = {
|
|
@@ -3095,7 +3095,7 @@ var require_ellipse = __commonJS({
|
|
|
3095
3095
|
segments = rotation < TAU ? segments + 1 : segments;
|
|
3096
3096
|
for (let i = 0; i < segments; i++) {
|
|
3097
3097
|
const angle = step * i + startAngle;
|
|
3098
|
-
const point = vec2.fromValues(radius[0] *
|
|
3098
|
+
const point = vec2.fromValues(radius[0] * cos2(angle), radius[1] * sin2(angle));
|
|
3099
3099
|
vec2.add(point, centerv, point);
|
|
3100
3100
|
points.push(point);
|
|
3101
3101
|
}
|
|
@@ -3405,7 +3405,7 @@ var require_Face = __commonJS({
|
|
|
3405
3405
|
var dot = require_dot2();
|
|
3406
3406
|
var length = require_length2();
|
|
3407
3407
|
var normalize = require_normalize2();
|
|
3408
|
-
var
|
|
3408
|
+
var scale2 = require_scale2();
|
|
3409
3409
|
var subtract3 = require_subtract2();
|
|
3410
3410
|
var HalfEdge = require_HalfEdge();
|
|
3411
3411
|
var VISIBLE = 0;
|
|
@@ -3453,7 +3453,7 @@ var require_Face = __commonJS({
|
|
|
3453
3453
|
this.nVertices += 1;
|
|
3454
3454
|
}
|
|
3455
3455
|
this.area = length(this.normal);
|
|
3456
|
-
this.normal =
|
|
3456
|
+
this.normal = scale2(this.normal, this.normal, 1 / this.area);
|
|
3457
3457
|
}
|
|
3458
3458
|
computeNormalMinArea(minArea) {
|
|
3459
3459
|
this.computeNormal();
|
|
@@ -3473,9 +3473,9 @@ var require_Face = __commonJS({
|
|
|
3473
3473
|
const p2 = maxEdge.head().point;
|
|
3474
3474
|
const maxVector = subtract3([], p2, p1);
|
|
3475
3475
|
const maxLength = Math.sqrt(maxSquaredLength);
|
|
3476
|
-
|
|
3476
|
+
scale2(maxVector, maxVector, 1 / maxLength);
|
|
3477
3477
|
const maxProjection = dot(this.normal, maxVector);
|
|
3478
|
-
|
|
3478
|
+
scale2(maxVector, maxVector, -maxProjection);
|
|
3479
3479
|
add(this.normal, this.normal, maxVector);
|
|
3480
3480
|
normalize(this.normal, this.normal);
|
|
3481
3481
|
}
|
|
@@ -3487,7 +3487,7 @@ var require_Face = __commonJS({
|
|
|
3487
3487
|
add(this.centroid, this.centroid, edge.head().point);
|
|
3488
3488
|
edge = edge.next;
|
|
3489
3489
|
} while (edge !== this.edge);
|
|
3490
|
-
|
|
3490
|
+
scale2(this.centroid, this.centroid, 1 / this.nVertices);
|
|
3491
3491
|
}
|
|
3492
3492
|
computeNormalAndCentroid(minArea) {
|
|
3493
3493
|
if (typeof minArea !== "undefined") {
|
|
@@ -4518,7 +4518,7 @@ var require_transform5 = __commonJS({
|
|
|
4518
4518
|
var vec3 = require_vec3();
|
|
4519
4519
|
var fromPoints = require_fromPoints4();
|
|
4520
4520
|
var flip = require_flip();
|
|
4521
|
-
var
|
|
4521
|
+
var transform2 = (out, plane, matrix) => {
|
|
4522
4522
|
const ismirror = mat4.isMirroring(matrix);
|
|
4523
4523
|
const r = vec3.orthogonal(vec3.create(), plane);
|
|
4524
4524
|
const u = vec3.cross(r, plane, r);
|
|
@@ -4536,7 +4536,7 @@ var require_transform5 = __commonJS({
|
|
|
4536
4536
|
}
|
|
4537
4537
|
return out;
|
|
4538
4538
|
};
|
|
4539
|
-
module.exports =
|
|
4539
|
+
module.exports = transform2;
|
|
4540
4540
|
}
|
|
4541
4541
|
});
|
|
4542
4542
|
|
|
@@ -4788,7 +4788,7 @@ var require_fromScalar3 = __commonJS({
|
|
|
4788
4788
|
var require_transform6 = __commonJS({
|
|
4789
4789
|
"node_modules/@jscad/modeling/src/maths/vec4/transform.js"(exports, module) {
|
|
4790
4790
|
"use strict";
|
|
4791
|
-
var
|
|
4791
|
+
var transform2 = (out, vector, matrix) => {
|
|
4792
4792
|
const [x, y, z, w] = vector;
|
|
4793
4793
|
out[0] = matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12] * w;
|
|
4794
4794
|
out[1] = matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13] * w;
|
|
@@ -4796,7 +4796,7 @@ var require_transform6 = __commonJS({
|
|
|
4796
4796
|
out[3] = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15] * w;
|
|
4797
4797
|
return out;
|
|
4798
4798
|
};
|
|
4799
|
-
module.exports =
|
|
4799
|
+
module.exports = transform2;
|
|
4800
4800
|
}
|
|
4801
4801
|
});
|
|
4802
4802
|
|
|
@@ -4917,14 +4917,14 @@ var require_transform7 = __commonJS({
|
|
|
4917
4917
|
var mat4 = require_mat4();
|
|
4918
4918
|
var vec3 = require_vec3();
|
|
4919
4919
|
var create = require_create7();
|
|
4920
|
-
var
|
|
4920
|
+
var transform2 = (matrix, polygon2) => {
|
|
4921
4921
|
const vertices = polygon2.vertices.map((vertex) => vec3.transform(vec3.create(), vertex, matrix));
|
|
4922
4922
|
if (mat4.isMirroring(matrix)) {
|
|
4923
4923
|
vertices.reverse();
|
|
4924
4924
|
}
|
|
4925
4925
|
return create(vertices);
|
|
4926
4926
|
};
|
|
4927
|
-
module.exports =
|
|
4927
|
+
module.exports = transform2;
|
|
4928
4928
|
}
|
|
4929
4929
|
});
|
|
4930
4930
|
|
|
@@ -5231,11 +5231,11 @@ var require_transform8 = __commonJS({
|
|
|
5231
5231
|
"node_modules/@jscad/modeling/src/geometries/geom3/transform.js"(exports, module) {
|
|
5232
5232
|
"use strict";
|
|
5233
5233
|
var mat4 = require_mat4();
|
|
5234
|
-
var
|
|
5234
|
+
var transform2 = (matrix, geometry) => {
|
|
5235
5235
|
const transforms = mat4.multiply(mat4.create(), matrix, geometry.transforms);
|
|
5236
5236
|
return Object.assign({}, geometry, { transforms });
|
|
5237
5237
|
};
|
|
5238
|
-
module.exports =
|
|
5238
|
+
module.exports = transform2;
|
|
5239
5239
|
}
|
|
5240
5240
|
});
|
|
5241
5241
|
|
|
@@ -5377,7 +5377,7 @@ var require_cylinderElliptic = __commonJS({
|
|
|
5377
5377
|
var vec3 = require_vec3();
|
|
5378
5378
|
var geom3 = require_geom3();
|
|
5379
5379
|
var poly3 = require_poly3();
|
|
5380
|
-
var { sin, cos } = require_trigonometry();
|
|
5380
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
5381
5381
|
var { isGT, isGTE, isNumberArray } = require_commonChecks();
|
|
5382
5382
|
var cylinderElliptic = (options) => {
|
|
5383
5383
|
const defaults = {
|
|
@@ -5423,8 +5423,8 @@ var require_cylinderElliptic = __commonJS({
|
|
|
5423
5423
|
const v3 = vec3.create();
|
|
5424
5424
|
const point = (stack, slice, radius) => {
|
|
5425
5425
|
const angle = slice * rotation + startAngle;
|
|
5426
|
-
vec3.scale(v1, axisX, radius[0] *
|
|
5427
|
-
vec3.scale(v2, axisY, radius[1] *
|
|
5426
|
+
vec3.scale(v1, axisX, radius[0] * cos2(angle));
|
|
5427
|
+
vec3.scale(v2, axisY, radius[1] * sin2(angle));
|
|
5428
5428
|
vec3.add(v1, v1, v2);
|
|
5429
5429
|
vec3.scale(v3, ray, stack);
|
|
5430
5430
|
vec3.add(v3, v3, start);
|
|
@@ -5478,7 +5478,7 @@ var require_cylinder = __commonJS({
|
|
|
5478
5478
|
var geom3 = require_geom3();
|
|
5479
5479
|
var cylinderElliptic = require_cylinderElliptic();
|
|
5480
5480
|
var { isGTE } = require_commonChecks();
|
|
5481
|
-
var
|
|
5481
|
+
var cylinder3 = (options) => {
|
|
5482
5482
|
const defaults = {
|
|
5483
5483
|
center: [0, 0, 0],
|
|
5484
5484
|
height: 2,
|
|
@@ -5497,7 +5497,7 @@ var require_cylinder = __commonJS({
|
|
|
5497
5497
|
};
|
|
5498
5498
|
return cylinderElliptic(newoptions);
|
|
5499
5499
|
};
|
|
5500
|
-
module.exports =
|
|
5500
|
+
module.exports = cylinder3;
|
|
5501
5501
|
}
|
|
5502
5502
|
});
|
|
5503
5503
|
|
|
@@ -5509,7 +5509,7 @@ var require_ellipsoid = __commonJS({
|
|
|
5509
5509
|
var vec3 = require_vec3();
|
|
5510
5510
|
var geom3 = require_geom3();
|
|
5511
5511
|
var poly3 = require_poly3();
|
|
5512
|
-
var { sin, cos } = require_trigonometry();
|
|
5512
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
5513
5513
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
5514
5514
|
var ellipsoid = (options) => {
|
|
5515
5515
|
const defaults = {
|
|
@@ -5534,13 +5534,13 @@ var require_ellipsoid = __commonJS({
|
|
|
5534
5534
|
const p2 = vec3.create();
|
|
5535
5535
|
for (let slice1 = 0; slice1 <= segments; slice1++) {
|
|
5536
5536
|
const angle = TAU * slice1 / segments;
|
|
5537
|
-
const cylinderpoint = vec3.add(vec3.create(), vec3.scale(p1, xvector,
|
|
5537
|
+
const cylinderpoint = vec3.add(vec3.create(), vec3.scale(p1, xvector, cos2(angle)), vec3.scale(p2, yvector, sin2(angle)));
|
|
5538
5538
|
if (slice1 > 0) {
|
|
5539
5539
|
let prevcospitch, prevsinpitch;
|
|
5540
5540
|
for (let slice2 = 0; slice2 <= qsegments; slice2++) {
|
|
5541
5541
|
const pitch = TAU / 4 * slice2 / qsegments;
|
|
5542
|
-
const cospitch =
|
|
5543
|
-
const sinpitch =
|
|
5542
|
+
const cospitch = cos2(pitch);
|
|
5543
|
+
const sinpitch = sin2(pitch);
|
|
5544
5544
|
if (slice2 > 0) {
|
|
5545
5545
|
let points = [];
|
|
5546
5546
|
let point;
|
|
@@ -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 line2 = (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 = line2;
|
|
5774
5774
|
}
|
|
5775
5775
|
});
|
|
5776
5776
|
|
|
@@ -5864,13 +5864,13 @@ var require_roundedCuboid = __commonJS({
|
|
|
5864
5864
|
var vec3 = require_vec3();
|
|
5865
5865
|
var geom3 = require_geom3();
|
|
5866
5866
|
var poly3 = require_poly3();
|
|
5867
|
-
var { sin, cos } = require_trigonometry();
|
|
5867
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
5868
5868
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
5869
5869
|
var cuboid4 = require_cuboid();
|
|
5870
5870
|
var createCorners = (center, size, radius, segments, slice, positive) => {
|
|
5871
5871
|
const pitch = TAU / 4 * slice / segments;
|
|
5872
|
-
const cospitch =
|
|
5873
|
-
const sinpitch =
|
|
5872
|
+
const cospitch = cos2(pitch);
|
|
5873
|
+
const sinpitch = sin2(pitch);
|
|
5874
5874
|
const layersegments = segments - slice;
|
|
5875
5875
|
let layerradius = radius * cospitch;
|
|
5876
5876
|
let layeroffset = size[2] - (radius - radius * sinpitch);
|
|
@@ -6016,9 +6016,9 @@ var require_roundedCylinder = __commonJS({
|
|
|
6016
6016
|
var vec3 = require_vec3();
|
|
6017
6017
|
var geom3 = require_geom3();
|
|
6018
6018
|
var poly3 = require_poly3();
|
|
6019
|
-
var { sin, cos } = require_trigonometry();
|
|
6019
|
+
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
6020
6020
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
6021
|
-
var
|
|
6021
|
+
var cylinder3 = require_cylinder();
|
|
6022
6022
|
var roundedCylinder = (options) => {
|
|
6023
6023
|
const defaults = {
|
|
6024
6024
|
center: [0, 0, 0],
|
|
@@ -6035,7 +6035,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
6035
6035
|
if (roundRadius > radius) throw new Error("roundRadius must be smaller than the radius");
|
|
6036
6036
|
if (!isGTE(segments, 4)) throw new Error("segments must be four or more");
|
|
6037
6037
|
if (height === 0 || radius === 0) return geom3.create();
|
|
6038
|
-
if (roundRadius === 0) return
|
|
6038
|
+
if (roundRadius === 0) return cylinder3({ center, height, radius });
|
|
6039
6039
|
const start = [0, 0, -(height / 2)];
|
|
6040
6040
|
const end = [0, 0, height / 2];
|
|
6041
6041
|
const direction = vec3.subtract(vec3.create(), end, start);
|
|
@@ -6063,7 +6063,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
6063
6063
|
let prevcylinderpoint;
|
|
6064
6064
|
for (let slice1 = 0; slice1 <= segments; slice1++) {
|
|
6065
6065
|
const angle = TAU * slice1 / segments;
|
|
6066
|
-
const cylinderpoint = vec3.add(vec3.create(), vec3.scale(v1, xvector,
|
|
6066
|
+
const cylinderpoint = vec3.add(vec3.create(), vec3.scale(v1, xvector, cos2(angle)), vec3.scale(v2, yvector, sin2(angle)));
|
|
6067
6067
|
if (slice1 > 0) {
|
|
6068
6068
|
let points = [];
|
|
6069
6069
|
points.push(vec3.add(vec3.create(), start, cylinderpoint));
|
|
@@ -6074,8 +6074,8 @@ var require_roundedCylinder = __commonJS({
|
|
|
6074
6074
|
let prevcospitch, prevsinpitch;
|
|
6075
6075
|
for (let slice2 = 0; slice2 <= qsegments; slice2++) {
|
|
6076
6076
|
const pitch = TAU / 4 * slice2 / qsegments;
|
|
6077
|
-
const cospitch =
|
|
6078
|
-
const sinpitch =
|
|
6077
|
+
const cospitch = cos2(pitch);
|
|
6078
|
+
const sinpitch = sin2(pitch);
|
|
6079
6079
|
if (slice2 > 0) {
|
|
6080
6080
|
points = [];
|
|
6081
6081
|
let point;
|
|
@@ -6792,10 +6792,10 @@ var require_eliminateHoles = __commonJS({
|
|
|
6792
6792
|
p = m;
|
|
6793
6793
|
do {
|
|
6794
6794
|
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
6795
|
-
const
|
|
6796
|
-
if (locallyInside(p, hole) && (
|
|
6795
|
+
const tan2 = Math.abs(hy - p.y) / (hx - p.x);
|
|
6796
|
+
if (locallyInside(p, hole) && (tan2 < tanMin || tan2 === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
|
|
6797
6797
|
m = p;
|
|
6798
|
-
tanMin =
|
|
6798
|
+
tanMin = tan2;
|
|
6799
6799
|
}
|
|
6800
6800
|
}
|
|
6801
6801
|
p = p.next;
|
|
@@ -7346,11 +7346,11 @@ var require_transform9 = __commonJS({
|
|
|
7346
7346
|
"use strict";
|
|
7347
7347
|
var vec3 = require_vec3();
|
|
7348
7348
|
var create = require_create9();
|
|
7349
|
-
var
|
|
7349
|
+
var transform2 = (matrix, slice) => {
|
|
7350
7350
|
const edges = slice.edges.map((edge) => [vec3.transform(vec3.create(), edge[0], matrix), vec3.transform(vec3.create(), edge[1], matrix)]);
|
|
7351
7351
|
return create(edges);
|
|
7352
7352
|
};
|
|
7353
|
-
module.exports =
|
|
7353
|
+
module.exports = transform2;
|
|
7354
7354
|
}
|
|
7355
7355
|
});
|
|
7356
7356
|
|
|
@@ -7660,7 +7660,7 @@ var require_rotate3 = __commonJS({
|
|
|
7660
7660
|
var geom2 = require_geom2();
|
|
7661
7661
|
var geom3 = require_geom3();
|
|
7662
7662
|
var path2 = require_path2();
|
|
7663
|
-
var
|
|
7663
|
+
var rotate2 = (angles, ...objects) => {
|
|
7664
7664
|
if (!Array.isArray(angles)) throw new Error("angles must be an array");
|
|
7665
7665
|
objects = flatten(objects);
|
|
7666
7666
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
@@ -7678,11 +7678,11 @@ var require_rotate3 = __commonJS({
|
|
|
7678
7678
|
});
|
|
7679
7679
|
return results.length === 1 ? results[0] : results;
|
|
7680
7680
|
};
|
|
7681
|
-
var rotateX = (angle, ...objects) =>
|
|
7682
|
-
var rotateY = (angle, ...objects) =>
|
|
7683
|
-
var rotateZ = (angle, ...objects) =>
|
|
7681
|
+
var rotateX = (angle, ...objects) => rotate2([angle, 0, 0], objects);
|
|
7682
|
+
var rotateY = (angle, ...objects) => rotate2([0, angle, 0], objects);
|
|
7683
|
+
var rotateZ = (angle, ...objects) => rotate2([0, 0, angle], objects);
|
|
7684
7684
|
module.exports = {
|
|
7685
|
-
rotate,
|
|
7685
|
+
rotate: rotate2,
|
|
7686
7686
|
rotateX,
|
|
7687
7687
|
rotateY,
|
|
7688
7688
|
rotateZ
|
|
@@ -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 translate4 = (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) => translate4([offset, 0, 0], objects);
|
|
7718
|
+
var translateY = (offset, ...objects) => translate4([0, offset, 0], objects);
|
|
7719
|
+
var translateZ = (offset, ...objects) => translate4([0, 0, offset], objects);
|
|
7720
7720
|
module.exports = {
|
|
7721
|
-
translate:
|
|
7721
|
+
translate: translate4,
|
|
7722
7722
|
translateX,
|
|
7723
7723
|
translateY,
|
|
7724
7724
|
translateZ
|
|
@@ -7732,8 +7732,8 @@ var require_torus = __commonJS({
|
|
|
7732
7732
|
"use strict";
|
|
7733
7733
|
var { TAU } = require_constants();
|
|
7734
7734
|
var extrudeRotate = require_extrudeRotate();
|
|
7735
|
-
var { rotate } = require_rotate3();
|
|
7736
|
-
var { translate:
|
|
7735
|
+
var { rotate: rotate2 } = require_rotate3();
|
|
7736
|
+
var { translate: translate4 } = require_translate2();
|
|
7737
7737
|
var circle = require_circle();
|
|
7738
7738
|
var { isGT, isGTE } = require_commonChecks();
|
|
7739
7739
|
var torus = (options) => {
|
|
@@ -7756,9 +7756,9 @@ var require_torus = __commonJS({
|
|
|
7756
7756
|
if (innerRadius >= outerRadius) throw new Error("inner circle is too large to rotate about the outer circle");
|
|
7757
7757
|
let innerCircle = circle({ radius: innerRadius, segments: innerSegments });
|
|
7758
7758
|
if (innerRotation !== 0) {
|
|
7759
|
-
innerCircle =
|
|
7759
|
+
innerCircle = rotate2([0, 0, innerRotation], innerCircle);
|
|
7760
7760
|
}
|
|
7761
|
-
innerCircle =
|
|
7761
|
+
innerCircle = translate4([outerRadius, 0], innerCircle);
|
|
7762
7762
|
const extrudeOptions = {
|
|
7763
7763
|
startAngle,
|
|
7764
7764
|
angle: outerRotation,
|
|
@@ -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 = (line2) => {
|
|
8517
8517
|
const out = create();
|
|
8518
|
-
out[0] =
|
|
8519
|
-
out[1] =
|
|
8520
|
-
out[2] =
|
|
8518
|
+
out[0] = line2[0];
|
|
8519
|
+
out[1] = line2[1];
|
|
8520
|
+
out[2] = line2[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 = (line2) => {
|
|
8533
|
+
const vector = vec2.normal(vec2.create(), line2);
|
|
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 = (line2) => vec2.scale(vec2.create(), line2, line2[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 = (line2, point) => {
|
|
8559
|
+
const orig = origin(line2);
|
|
8560
|
+
const dir = direction(line2);
|
|
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, line2) => {
|
|
8576
|
+
out[0] = line2[0];
|
|
8577
|
+
out[1] = line2[1];
|
|
8578
|
+
out[2] = line2[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 = (line2, point) => {
|
|
8591
|
+
let distance = vec2.dot(point, line2);
|
|
8592
|
+
distance = Math.abs(distance - line2[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, line2) => line1[0] === line2[0] && (line1[1] === line2[1] && line1[2] === line2[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, line2) => {
|
|
8650
|
+
const point = solve2Linear(line1[0], line1[1], line2[0], line2[1], line1[2], line2[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, line2) => {
|
|
8665
|
+
const normal = vec2.negate(vec2.create(), line2);
|
|
8666
|
+
const distance = -line2[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 = (line2) => `line2: (${line2[0].toFixed(7)}, ${line2[1].toFixed(7)}, ${line2[2].toFixed(7)})`;
|
|
8678
8678
|
module.exports = toString;
|
|
8679
8679
|
}
|
|
8680
8680
|
});
|
|
@@ -8687,14 +8687,14 @@ var require_transform10 = __commonJS({
|
|
|
8687
8687
|
var fromPoints = require_fromPoints7();
|
|
8688
8688
|
var origin = require_origin();
|
|
8689
8689
|
var direction = require_direction();
|
|
8690
|
-
var
|
|
8691
|
-
const org = origin(
|
|
8692
|
-
const dir = direction(
|
|
8690
|
+
var transform2 = (out, line2, matrix) => {
|
|
8691
|
+
const org = origin(line2);
|
|
8692
|
+
const dir = direction(line2);
|
|
8693
8693
|
vec2.transform(org, org, matrix);
|
|
8694
8694
|
vec2.transform(dir, dir, matrix);
|
|
8695
8695
|
return fromPoints(out, org, dir);
|
|
8696
8696
|
};
|
|
8697
|
-
module.exports =
|
|
8697
|
+
module.exports = transform2;
|
|
8698
8698
|
}
|
|
8699
8699
|
});
|
|
8700
8700
|
|
|
@@ -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 = (line2, y) => {
|
|
8707
|
+
let x = (line2[2] - line2[1] * y) / line2[0];
|
|
8708
8708
|
if (Number.isNaN(x)) {
|
|
8709
|
-
const org = origin(
|
|
8709
|
+
const org = origin(line2);
|
|
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 line2 = 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 = line2.create();
|
|
8813
|
+
const line1 = line2.create();
|
|
8814
8814
|
newCorners.forEach((corner) => {
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
const ip =
|
|
8815
|
+
line2.fromPoints(line0, corner.s0[0], corner.s0[1]);
|
|
8816
|
+
line2.fromPoints(line1, corner.s1[0], corner.s1[1]);
|
|
8817
|
+
const ip = line2.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 line2 = 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: line2.fromPoints(line2.create(), topleft, bottomleft),
|
|
9496
|
+
rightline: line2.fromPoints(line2.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 = line2.direction(thispolygon.leftline);
|
|
9523
|
+
const v2 = line2.direction(prevpolygon.leftline);
|
|
9524
9524
|
const d1 = v1[0] - v2[0];
|
|
9525
|
-
const v3 =
|
|
9526
|
-
const v4 =
|
|
9525
|
+
const v3 = line2.direction(thispolygon.rightline);
|
|
9526
|
+
const v4 = line2.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;
|
|
@@ -10468,8 +10468,8 @@ var require_expandShell = __commonJS({
|
|
|
10468
10468
|
endfacevertices.reverse();
|
|
10469
10469
|
polygons2.push(poly3.create(startfacevertices));
|
|
10470
10470
|
polygons2.push(poly3.create(endfacevertices));
|
|
10471
|
-
const
|
|
10472
|
-
result = unionGeom3Sub(result,
|
|
10471
|
+
const cylinder3 = geom3.create(polygons2);
|
|
10472
|
+
result = unionGeom3Sub(result, cylinder3);
|
|
10473
10473
|
});
|
|
10474
10474
|
vertices2planes.forEach((item) => {
|
|
10475
10475
|
const vertex = item[0];
|
|
@@ -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: translate4 } = 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 translate4(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: translate4 } = 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 translate4(offset, object);
|
|
11012
11012
|
};
|
|
11013
11013
|
var center = (options, ...objects) => {
|
|
11014
11014
|
const defaults = {
|
|
@@ -11050,7 +11050,7 @@ var require_scale4 = __commonJS({
|
|
|
11050
11050
|
var geom2 = require_geom2();
|
|
11051
11051
|
var geom3 = require_geom3();
|
|
11052
11052
|
var path2 = require_path2();
|
|
11053
|
-
var
|
|
11053
|
+
var scale2 = (factors, ...objects) => {
|
|
11054
11054
|
if (!Array.isArray(factors)) throw new Error("factors must be an array");
|
|
11055
11055
|
objects = flatten(objects);
|
|
11056
11056
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
@@ -11066,11 +11066,11 @@ var require_scale4 = __commonJS({
|
|
|
11066
11066
|
});
|
|
11067
11067
|
return results.length === 1 ? results[0] : results;
|
|
11068
11068
|
};
|
|
11069
|
-
var scaleX = (factor, ...objects) =>
|
|
11070
|
-
var scaleY = (factor, ...objects) =>
|
|
11071
|
-
var scaleZ = (factor, ...objects) =>
|
|
11069
|
+
var scaleX = (factor, ...objects) => scale2([factor, 1, 1], objects);
|
|
11070
|
+
var scaleY = (factor, ...objects) => scale2([1, factor, 1], objects);
|
|
11071
|
+
var scaleZ = (factor, ...objects) => scale2([1, 1, factor], objects);
|
|
11072
11072
|
module.exports = {
|
|
11073
|
-
scale,
|
|
11073
|
+
scale: scale2,
|
|
11074
11074
|
scaleX,
|
|
11075
11075
|
scaleY,
|
|
11076
11076
|
scaleZ
|
|
@@ -11086,7 +11086,7 @@ var require_transform11 = __commonJS({
|
|
|
11086
11086
|
var geom2 = require_geom2();
|
|
11087
11087
|
var geom3 = require_geom3();
|
|
11088
11088
|
var path2 = require_path2();
|
|
11089
|
-
var
|
|
11089
|
+
var transform2 = (matrix, ...objects) => {
|
|
11090
11090
|
objects = flatten(objects);
|
|
11091
11091
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
11092
11092
|
const results = objects.map((object) => {
|
|
@@ -11097,7 +11097,7 @@ var require_transform11 = __commonJS({
|
|
|
11097
11097
|
});
|
|
11098
11098
|
return results.length === 1 ? results[0] : results;
|
|
11099
11099
|
};
|
|
11100
|
-
module.exports =
|
|
11100
|
+
module.exports = transform2;
|
|
11101
11101
|
}
|
|
11102
11102
|
});
|
|
11103
11103
|
|
|
@@ -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, line2) => {
|
|
11711
11711
|
const { x, y } = Object.assign({ x: 0, y: 0 }, options || {});
|
|
11712
|
-
const segments =
|
|
11712
|
+
const segments = line2.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 line2;
|
|
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 line2 = { 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(line2);
|
|
11745
|
+
maxWidth = Math.max(maxWidth, line2.width);
|
|
11746
|
+
line2 = { 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
|
+
line2.width += width;
|
|
11759
11759
|
x += width;
|
|
11760
11760
|
if (char !== " ") {
|
|
11761
|
-
|
|
11761
|
+
line2.segments = line2.segments.concat(vect.segments);
|
|
11762
11762
|
}
|
|
11763
11763
|
}
|
|
11764
|
-
if (
|
|
11764
|
+
if (line2.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
|
+
line2 = lines[i];
|
|
11769
|
+
if (maxWidth > line2.width) {
|
|
11770
|
+
diff = maxWidth - line2.width;
|
|
11771
11771
|
if (align === "right") {
|
|
11772
|
-
|
|
11772
|
+
line2 = translateLine({ x: diff }, line2);
|
|
11773
11773
|
} else if (align === "center") {
|
|
11774
|
-
|
|
11774
|
+
line2 = translateLine({ x: diff / 2 }, line2);
|
|
11775
11775
|
}
|
|
11776
11776
|
}
|
|
11777
|
-
output = output.concat(
|
|
11777
|
+
output = output.concat(line2.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 = (line2) => {
|
|
12055
12055
|
const out = create();
|
|
12056
|
-
vec3.copy(out[0],
|
|
12057
|
-
vec3.copy(out[1],
|
|
12056
|
+
vec3.copy(out[0], line2[0]);
|
|
12057
|
+
vec3.copy(out[1], line2[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 = (line2, point) => {
|
|
12070
|
+
const lpoint = line2[0];
|
|
12071
|
+
const ldirection = line2[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, line2) => {
|
|
12089
|
+
vec3.copy(out[0], line2[0]);
|
|
12090
|
+
vec3.copy(out[1], line2[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 = (line2) => line2[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 = (line2, point) => {
|
|
12113
|
+
const closest = closestPoint(line2, 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, line2) => {
|
|
12127
|
+
if (!vec3.equals(line1[1], line2[1])) return false;
|
|
12128
|
+
if (!vec3.equals(line1[0], line2[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 = (line2, plane) => {
|
|
12207
12207
|
const pnormal = plane;
|
|
12208
12208
|
const pw = plane[3];
|
|
12209
|
-
const lpoint =
|
|
12210
|
-
const ldirection =
|
|
12209
|
+
const lpoint = line2[0];
|
|
12210
|
+
const ldirection = line2[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 = (line2) => line2[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, line2) => {
|
|
12235
|
+
const point = vec3.clone(line2[0]);
|
|
12236
|
+
const direction = vec3.negate(vec3.create(), line2[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 = (line2) => {
|
|
12248
|
+
const point = line2[0];
|
|
12249
|
+
const direction = line2[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,16 +12259,16 @@ var require_transform12 = __commonJS({
|
|
|
12259
12259
|
"use strict";
|
|
12260
12260
|
var vec3 = require_vec3();
|
|
12261
12261
|
var fromPointAndDirection = require_fromPointAndDirection();
|
|
12262
|
-
var
|
|
12263
|
-
const point =
|
|
12264
|
-
const direction =
|
|
12262
|
+
var transform2 = (out, line2, matrix) => {
|
|
12263
|
+
const point = line2[0];
|
|
12264
|
+
const direction = line2[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);
|
|
12268
12268
|
const newdirection = vec3.subtract(newPointPlusDirection, newPointPlusDirection, newpoint);
|
|
12269
12269
|
return fromPointAndDirection(out, newpoint, newdirection);
|
|
12270
12270
|
};
|
|
12271
|
-
module.exports =
|
|
12271
|
+
module.exports = transform2;
|
|
12272
12272
|
}
|
|
12273
12273
|
});
|
|
12274
12274
|
|
|
@@ -15509,15 +15509,15 @@ var GLTFWriter = class {
|
|
|
15509
15509
|
if (options.trs) {
|
|
15510
15510
|
const rotation = object.quaternion.toArray();
|
|
15511
15511
|
const position = object.position.toArray();
|
|
15512
|
-
const
|
|
15512
|
+
const scale2 = object.scale.toArray();
|
|
15513
15513
|
if (!equalArray(rotation, [0, 0, 0, 1])) {
|
|
15514
15514
|
nodeDef.rotation = rotation;
|
|
15515
15515
|
}
|
|
15516
15516
|
if (!equalArray(position, [0, 0, 0])) {
|
|
15517
15517
|
nodeDef.translation = position;
|
|
15518
15518
|
}
|
|
15519
|
-
if (!equalArray(
|
|
15520
|
-
nodeDef.scale =
|
|
15519
|
+
if (!equalArray(scale2, [1, 1, 1])) {
|
|
15520
|
+
nodeDef.scale = scale2;
|
|
15521
15521
|
}
|
|
15522
15522
|
} else {
|
|
15523
15523
|
if (object.matrixAutoUpdate) {
|
|
@@ -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 line2 = lines[i];
|
|
16236
|
+
line2 = line2.trim();
|
|
16237
|
+
if (line2.length === 0 || line2.charAt(0) === "#") {
|
|
16238
16238
|
continue;
|
|
16239
16239
|
}
|
|
16240
|
-
const pos =
|
|
16241
|
-
let key = pos >= 0 ?
|
|
16240
|
+
const pos = line2.indexOf(" ");
|
|
16241
|
+
let key = pos >= 0 ? line2.substring(0, pos) : line2;
|
|
16242
16242
|
key = key.toLowerCase();
|
|
16243
|
-
let value = pos >= 0 ?
|
|
16243
|
+
let value = pos >= 0 ? line2.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 line2 = "", 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
|
+
line2 = lines[i];
|
|
16762
|
+
line2 = trimLeft ? line2.trimLeft() : line2.trim();
|
|
16763
|
+
lineLength = line2.length;
|
|
16764
16764
|
if (lineLength === 0)
|
|
16765
16765
|
continue;
|
|
16766
|
-
lineFirstChar =
|
|
16766
|
+
lineFirstChar = line2.charAt(0);
|
|
16767
16767
|
if (lineFirstChar === "#")
|
|
16768
16768
|
continue;
|
|
16769
16769
|
if (lineFirstChar === "v") {
|
|
16770
|
-
const data =
|
|
16770
|
+
const data = line2.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 = line2.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 = line2.substring(1).trim().split(" ");
|
|
16806
16806
|
let lineVertices = [];
|
|
16807
16807
|
const lineUVs = [];
|
|
16808
|
-
if (
|
|
16808
|
+
if (line2.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 = line2.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(line2)) !== 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(line2)) {
|
|
16828
|
+
state.object.startMaterial(line2.substring(7).trim(), state.materialLibraries);
|
|
16829
|
+
} else if (_material_library_pattern.test(line2)) {
|
|
16830
|
+
state.materialLibraries.push(line2.substring(7).trim());
|
|
16831
|
+
} else if (_map_use_pattern.test(line2)) {
|
|
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 = line2.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 (line2 === "\0")
|
|
16848
16848
|
continue;
|
|
16849
|
-
console.warn('THREE.OBJLoader: Unexpected line: "' +
|
|
16849
|
+
console.warn('THREE.OBJLoader: Unexpected line: "' + line2 + '"');
|
|
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.201",
|
|
16986
16986
|
main: "./dist/index.js",
|
|
16987
16987
|
module: "./dist/index.js",
|
|
16988
16988
|
type: "module",
|
|
@@ -17046,7 +17046,7 @@ var package_default = {
|
|
|
17046
17046
|
"@vitejs/plugin-react": "^4.3.4",
|
|
17047
17047
|
"bun-match-svg": "^0.0.9",
|
|
17048
17048
|
"bun-types": "^1.2.1",
|
|
17049
|
-
"circuit-json": "^0.0.
|
|
17049
|
+
"circuit-json": "^0.0.154",
|
|
17050
17050
|
"circuit-to-svg": "^0.0.91",
|
|
17051
17051
|
debug: "^4.4.0",
|
|
17052
17052
|
jsdom: "^26.0.0",
|
|
@@ -17302,7 +17302,17 @@ var M = 0.01;
|
|
|
17302
17302
|
var colors = {
|
|
17303
17303
|
copper: [0.9, 0.6, 0.2],
|
|
17304
17304
|
fr4Green: [5 / 255, 163 / 255, 46 / 255],
|
|
17305
|
-
fr4GreenSolderWithMask: [0 / 255, 152 / 255, 19 / 255]
|
|
17305
|
+
fr4GreenSolderWithMask: [0 / 255, 152 / 255, 19 / 255],
|
|
17306
|
+
fr1Copper: [0.8, 0.4, 0.2],
|
|
17307
|
+
fr1CopperSolderWithMask: [0.9, 0.6, 0.2]
|
|
17308
|
+
};
|
|
17309
|
+
var boardMaterialColors = {
|
|
17310
|
+
fr1: colors.fr1Copper,
|
|
17311
|
+
fr4: colors.fr4Green
|
|
17312
|
+
};
|
|
17313
|
+
var tracesMaterialColors = {
|
|
17314
|
+
fr1: colors.fr1CopperSolderWithMask,
|
|
17315
|
+
fr4: colors.fr4GreenSolderWithMask
|
|
17306
17316
|
};
|
|
17307
17317
|
|
|
17308
17318
|
// src/geoms/create-board-with-outline.ts
|
|
@@ -17354,7 +17364,8 @@ var createSimplifiedBoardGeom = (circuitJson) => {
|
|
|
17354
17364
|
center: [board.center.x, board.center.y, 0]
|
|
17355
17365
|
});
|
|
17356
17366
|
}
|
|
17357
|
-
|
|
17367
|
+
const material = boardMaterialColors[board.material] ?? colors.fr4Green;
|
|
17368
|
+
return [(0, import_colors.colorize)(material, boardGeom)];
|
|
17358
17369
|
};
|
|
17359
17370
|
var createBoardGeomFromCircuitJson = (circuitJson, opts = {}) => {
|
|
17360
17371
|
console.warn(
|
|
@@ -17501,11 +17512,224 @@ var import_expansions = __toESM(require_expansions(), 1);
|
|
|
17501
17512
|
|
|
17502
17513
|
// src/geoms/create-geoms-for-silkscreen-text.ts
|
|
17503
17514
|
var import_text = __toESM(require_text(), 1);
|
|
17515
|
+
|
|
17516
|
+
// node_modules/transformation-matrix/src/applyToPoint.js
|
|
17517
|
+
function applyToPoint(matrix, point) {
|
|
17518
|
+
return Array.isArray(point) ? [
|
|
17519
|
+
matrix.a * point[0] + matrix.c * point[1] + matrix.e,
|
|
17520
|
+
matrix.b * point[0] + matrix.d * point[1] + matrix.f
|
|
17521
|
+
] : {
|
|
17522
|
+
x: matrix.a * point.x + matrix.c * point.y + matrix.e,
|
|
17523
|
+
y: matrix.b * point.x + matrix.d * point.y + matrix.f
|
|
17524
|
+
};
|
|
17525
|
+
}
|
|
17526
|
+
|
|
17527
|
+
// node_modules/transformation-matrix/src/utils.js
|
|
17528
|
+
function isUndefined(val) {
|
|
17529
|
+
return typeof val === "undefined";
|
|
17530
|
+
}
|
|
17531
|
+
|
|
17532
|
+
// node_modules/transformation-matrix/src/translate.js
|
|
17533
|
+
function translate2(tx, ty = 0) {
|
|
17534
|
+
return {
|
|
17535
|
+
a: 1,
|
|
17536
|
+
c: 0,
|
|
17537
|
+
e: tx,
|
|
17538
|
+
b: 0,
|
|
17539
|
+
d: 1,
|
|
17540
|
+
f: ty
|
|
17541
|
+
};
|
|
17542
|
+
}
|
|
17543
|
+
|
|
17544
|
+
// node_modules/transformation-matrix/src/transform.js
|
|
17545
|
+
function transform(...matrices) {
|
|
17546
|
+
matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
|
|
17547
|
+
const multiply = (m1, m2) => {
|
|
17548
|
+
return {
|
|
17549
|
+
a: m1.a * m2.a + m1.c * m2.b,
|
|
17550
|
+
c: m1.a * m2.c + m1.c * m2.d,
|
|
17551
|
+
e: m1.a * m2.e + m1.c * m2.f + m1.e,
|
|
17552
|
+
b: m1.b * m2.a + m1.d * m2.b,
|
|
17553
|
+
d: m1.b * m2.c + m1.d * m2.d,
|
|
17554
|
+
f: m1.b * m2.e + m1.d * m2.f + m1.f
|
|
17555
|
+
};
|
|
17556
|
+
};
|
|
17557
|
+
switch (matrices.length) {
|
|
17558
|
+
case 0:
|
|
17559
|
+
throw new Error("no matrices provided");
|
|
17560
|
+
case 1:
|
|
17561
|
+
return matrices[0];
|
|
17562
|
+
case 2:
|
|
17563
|
+
return multiply(matrices[0], matrices[1]);
|
|
17564
|
+
default: {
|
|
17565
|
+
const [m1, m2, ...rest] = matrices;
|
|
17566
|
+
const m = multiply(m1, m2);
|
|
17567
|
+
return transform(m, ...rest);
|
|
17568
|
+
}
|
|
17569
|
+
}
|
|
17570
|
+
}
|
|
17571
|
+
function compose(...matrices) {
|
|
17572
|
+
return transform(...matrices);
|
|
17573
|
+
}
|
|
17574
|
+
|
|
17575
|
+
// node_modules/transformation-matrix/src/rotate.js
|
|
17576
|
+
var { cos, sin, PI } = Math;
|
|
17577
|
+
function rotate(angle, cx, cy) {
|
|
17578
|
+
const cosAngle = cos(angle);
|
|
17579
|
+
const sinAngle = sin(angle);
|
|
17580
|
+
const rotationMatrix = {
|
|
17581
|
+
a: cosAngle,
|
|
17582
|
+
c: -sinAngle,
|
|
17583
|
+
e: 0,
|
|
17584
|
+
b: sinAngle,
|
|
17585
|
+
d: cosAngle,
|
|
17586
|
+
f: 0
|
|
17587
|
+
};
|
|
17588
|
+
if (isUndefined(cx) || isUndefined(cy)) {
|
|
17589
|
+
return rotationMatrix;
|
|
17590
|
+
}
|
|
17591
|
+
return transform([
|
|
17592
|
+
translate2(cx, cy),
|
|
17593
|
+
rotationMatrix,
|
|
17594
|
+
translate2(-cx, -cy)
|
|
17595
|
+
]);
|
|
17596
|
+
}
|
|
17597
|
+
|
|
17598
|
+
// node_modules/transformation-matrix/src/skew.js
|
|
17599
|
+
var { tan } = Math;
|
|
17600
|
+
|
|
17601
|
+
// node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js
|
|
17602
|
+
function peg$subclass(child, parent) {
|
|
17603
|
+
function C() {
|
|
17604
|
+
this.constructor = child;
|
|
17605
|
+
}
|
|
17606
|
+
C.prototype = parent.prototype;
|
|
17607
|
+
child.prototype = new C();
|
|
17608
|
+
}
|
|
17609
|
+
function peg$SyntaxError(message, expected, found, location) {
|
|
17610
|
+
var self = Error.call(this, message);
|
|
17611
|
+
if (Object.setPrototypeOf) {
|
|
17612
|
+
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
17613
|
+
}
|
|
17614
|
+
self.expected = expected;
|
|
17615
|
+
self.found = found;
|
|
17616
|
+
self.location = location;
|
|
17617
|
+
self.name = "SyntaxError";
|
|
17618
|
+
return self;
|
|
17619
|
+
}
|
|
17620
|
+
peg$subclass(peg$SyntaxError, Error);
|
|
17621
|
+
function peg$padEnd(str, targetLength, padString) {
|
|
17622
|
+
padString = padString || " ";
|
|
17623
|
+
if (str.length > targetLength) {
|
|
17624
|
+
return str;
|
|
17625
|
+
}
|
|
17626
|
+
targetLength -= str.length;
|
|
17627
|
+
padString += padString.repeat(targetLength);
|
|
17628
|
+
return str + padString.slice(0, targetLength);
|
|
17629
|
+
}
|
|
17630
|
+
peg$SyntaxError.prototype.format = function(sources) {
|
|
17631
|
+
var str = "Error: " + this.message;
|
|
17632
|
+
if (this.location) {
|
|
17633
|
+
var src = null;
|
|
17634
|
+
var k;
|
|
17635
|
+
for (k = 0; k < sources.length; k++) {
|
|
17636
|
+
if (sources[k].source === this.location.source) {
|
|
17637
|
+
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
17638
|
+
break;
|
|
17639
|
+
}
|
|
17640
|
+
}
|
|
17641
|
+
var s = this.location.start;
|
|
17642
|
+
var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
|
|
17643
|
+
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
17644
|
+
if (src) {
|
|
17645
|
+
var e = this.location.end;
|
|
17646
|
+
var filler = peg$padEnd("", offset_s.line.toString().length, " ");
|
|
17647
|
+
var line2 = src[s.line - 1];
|
|
17648
|
+
var last = s.line === e.line ? e.column : line2.length + 1;
|
|
17649
|
+
var hatLen = last - s.column || 1;
|
|
17650
|
+
str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line2 + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
|
|
17651
|
+
} else {
|
|
17652
|
+
str += "\n at " + loc;
|
|
17653
|
+
}
|
|
17654
|
+
}
|
|
17655
|
+
return str;
|
|
17656
|
+
};
|
|
17657
|
+
peg$SyntaxError.buildMessage = function(expected, found) {
|
|
17658
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
17659
|
+
literal: function(expectation) {
|
|
17660
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
17661
|
+
},
|
|
17662
|
+
class: function(expectation) {
|
|
17663
|
+
var escapedParts = expectation.parts.map(function(part) {
|
|
17664
|
+
return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
|
|
17665
|
+
});
|
|
17666
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
17667
|
+
},
|
|
17668
|
+
any: function() {
|
|
17669
|
+
return "any character";
|
|
17670
|
+
},
|
|
17671
|
+
end: function() {
|
|
17672
|
+
return "end of input";
|
|
17673
|
+
},
|
|
17674
|
+
other: function(expectation) {
|
|
17675
|
+
return expectation.description;
|
|
17676
|
+
}
|
|
17677
|
+
};
|
|
17678
|
+
function hex(ch) {
|
|
17679
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
17680
|
+
}
|
|
17681
|
+
function literalEscape(s) {
|
|
17682
|
+
return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
17683
|
+
return "\\x0" + hex(ch);
|
|
17684
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
17685
|
+
return "\\x" + hex(ch);
|
|
17686
|
+
});
|
|
17687
|
+
}
|
|
17688
|
+
function classEscape(s) {
|
|
17689
|
+
return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
17690
|
+
return "\\x0" + hex(ch);
|
|
17691
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
17692
|
+
return "\\x" + hex(ch);
|
|
17693
|
+
});
|
|
17694
|
+
}
|
|
17695
|
+
function describeExpectation(expectation) {
|
|
17696
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
17697
|
+
}
|
|
17698
|
+
function describeExpected(expected2) {
|
|
17699
|
+
var descriptions = expected2.map(describeExpectation);
|
|
17700
|
+
var i, j;
|
|
17701
|
+
descriptions.sort();
|
|
17702
|
+
if (descriptions.length > 0) {
|
|
17703
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
17704
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
17705
|
+
descriptions[j] = descriptions[i];
|
|
17706
|
+
j++;
|
|
17707
|
+
}
|
|
17708
|
+
}
|
|
17709
|
+
descriptions.length = j;
|
|
17710
|
+
}
|
|
17711
|
+
switch (descriptions.length) {
|
|
17712
|
+
case 1:
|
|
17713
|
+
return descriptions[0];
|
|
17714
|
+
case 2:
|
|
17715
|
+
return descriptions[0] + " or " + descriptions[1];
|
|
17716
|
+
default:
|
|
17717
|
+
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
17718
|
+
}
|
|
17719
|
+
}
|
|
17720
|
+
function describeFound(found2) {
|
|
17721
|
+
return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
|
|
17722
|
+
}
|
|
17723
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
17724
|
+
};
|
|
17725
|
+
|
|
17726
|
+
// src/geoms/create-geoms-for-silkscreen-text.ts
|
|
17504
17727
|
function createSilkscreenTextGeoms(silkscreenText) {
|
|
17505
17728
|
const textOutlines = (0, import_text.vectorText)({
|
|
17506
17729
|
height: silkscreenText.font_size,
|
|
17507
17730
|
input: silkscreenText.text
|
|
17508
17731
|
});
|
|
17732
|
+
let rotationDegrees = silkscreenText.ccw_rotation ?? 0;
|
|
17509
17733
|
textOutlines.forEach((outline) => {
|
|
17510
17734
|
if (outline.length === 29) {
|
|
17511
17735
|
textOutlines.splice(
|
|
@@ -17552,7 +17776,39 @@ function createSilkscreenTextGeoms(silkscreenText) {
|
|
|
17552
17776
|
} else if (silkscreenText.anchor_alignment?.includes("bottom")) {
|
|
17553
17777
|
yOffset = -textBounds.minY;
|
|
17554
17778
|
}
|
|
17555
|
-
|
|
17779
|
+
const transforms = [];
|
|
17780
|
+
if (silkscreenText.layer === "bottom") {
|
|
17781
|
+
transforms.push(
|
|
17782
|
+
translate2(centerX, centerY),
|
|
17783
|
+
{ a: -1, b: 0, c: 0, d: 1, e: 0, f: 0 },
|
|
17784
|
+
// horizontal flip matrix
|
|
17785
|
+
translate2(-centerX, -centerY)
|
|
17786
|
+
);
|
|
17787
|
+
rotationDegrees = -rotationDegrees;
|
|
17788
|
+
}
|
|
17789
|
+
if (rotationDegrees) {
|
|
17790
|
+
const rad = rotationDegrees * Math.PI / 180;
|
|
17791
|
+
transforms.push(
|
|
17792
|
+
translate2(centerX, centerY),
|
|
17793
|
+
rotate(rad),
|
|
17794
|
+
translate2(-centerX, -centerY)
|
|
17795
|
+
);
|
|
17796
|
+
}
|
|
17797
|
+
let transformedOutlines = textOutlines;
|
|
17798
|
+
if (transforms.length > 0) {
|
|
17799
|
+
const matrix = compose(...transforms);
|
|
17800
|
+
transformedOutlines = textOutlines.map(
|
|
17801
|
+
(outline) => outline.map(([x, y]) => {
|
|
17802
|
+
const { x: nx, y: ny } = applyToPoint(matrix, { x, y });
|
|
17803
|
+
return [nx, ny];
|
|
17804
|
+
})
|
|
17805
|
+
);
|
|
17806
|
+
}
|
|
17807
|
+
return {
|
|
17808
|
+
textOutlines: transformedOutlines,
|
|
17809
|
+
xOffset,
|
|
17810
|
+
yOffset
|
|
17811
|
+
};
|
|
17556
17812
|
}
|
|
17557
17813
|
|
|
17558
17814
|
// src/BoardGeomBuilder.ts
|
|
@@ -17789,7 +18045,8 @@ var BoardGeomBuilder = class {
|
|
|
17789
18045
|
[0, 0, zPos],
|
|
17790
18046
|
(0, import_extrusions2.extrudeLinear)({ height: M }, expandedPath)
|
|
17791
18047
|
);
|
|
17792
|
-
|
|
18048
|
+
const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.fr4GreenSolderWithMask;
|
|
18049
|
+
traceGeom = (0, import_colors3.colorize)(tracesMaterialColor, traceGeom);
|
|
17793
18050
|
this.traceGeoms.push(traceGeom);
|
|
17794
18051
|
}
|
|
17795
18052
|
currentSegmentPoints = [];
|
|
@@ -17866,18 +18123,28 @@ var BoardGeomBuilder = class {
|
|
|
17866
18123
|
{ delta: expansionDelta, corners: "round" },
|
|
17867
18124
|
textPath
|
|
17868
18125
|
);
|
|
17869
|
-
let textGeom
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
18126
|
+
let textGeom;
|
|
18127
|
+
if (st.layer === "bottom") {
|
|
18128
|
+
textGeom = (0, import_transforms2.translate)(
|
|
18129
|
+
[0, 0, -this.ctx.pcbThickness / 2 - M],
|
|
18130
|
+
// Position above board
|
|
18131
|
+
(0, import_extrusions2.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
18132
|
+
);
|
|
18133
|
+
} else {
|
|
18134
|
+
textGeom = (0, import_transforms2.translate)(
|
|
18135
|
+
[0, 0, this.ctx.pcbThickness / 2 + M],
|
|
18136
|
+
// Position above board
|
|
18137
|
+
(0, import_extrusions2.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
18138
|
+
);
|
|
18139
|
+
}
|
|
17874
18140
|
textGeom = (0, import_colors3.colorize)([1, 1, 1], textGeom);
|
|
17875
18141
|
this.silkscreenGeoms.push(textGeom);
|
|
17876
18142
|
}
|
|
17877
18143
|
}
|
|
17878
18144
|
finalize() {
|
|
17879
18145
|
if (!this.boardGeom) return;
|
|
17880
|
-
this.
|
|
18146
|
+
const boardMaterialColor = boardMaterialColors[this.board.material] ?? colors.fr4Green;
|
|
18147
|
+
this.boardGeom = (0, import_colors3.colorize)(boardMaterialColor, this.boardGeom);
|
|
17881
18148
|
this.finalGeoms = [
|
|
17882
18149
|
this.boardGeom,
|
|
17883
18150
|
...this.platedHoleGeoms,
|
|
@@ -18714,8 +18981,8 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
18714
18981
|
scene.position.sub(center);
|
|
18715
18982
|
const maxDim = Math.max(size.x, size.y, size.z);
|
|
18716
18983
|
if (maxDim > 0) {
|
|
18717
|
-
const
|
|
18718
|
-
scene.scale.multiplyScalar(
|
|
18984
|
+
const scale2 = (1 - padding / 100) / maxDim;
|
|
18985
|
+
scene.scale.multiplyScalar(scale2 * 100);
|
|
18719
18986
|
}
|
|
18720
18987
|
camera.updateProjectionMatrix();
|
|
18721
18988
|
renderer.render(scene, camera);
|