brepjs 18.63.0 → 18.64.0
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/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{blueprint-DaRszQg-.js → blueprint-B-auug94.js} +5 -5
- package/dist/{blueprint-XEJiK6ON.cjs → blueprint-CnGsBG6y.cjs} +5 -5
- package/dist/{blueprintFns-C0ULkqGT.js → blueprintFns-Bpp0oBUG.js} +2 -2
- package/dist/{blueprintFns-CTJGTMYw.cjs → blueprintFns-CocKjMHz.cjs} +2 -2
- package/dist/{blueprintSketcher-DHWmjOmJ.js → blueprintSketcher-BmCyc7s1.js} +3 -3
- package/dist/{blueprintSketcher-r0uUFBZZ.cjs → blueprintSketcher-J9bAQDhD.cjs} +3 -3
- package/dist/{boolean2D-BfavHsXe.js → boolean2D-C-tW10ip.js} +4 -4
- package/dist/{boolean2D-BT3RGDXW.cjs → boolean2D-zhHdr4EG.cjs} +4 -4
- package/dist/{booleanFns-DNG6xxu8.js → booleanFns-4_KnvEil.js} +4 -4
- package/dist/{booleanFns-B3vIRhjz.cjs → booleanFns-9qTQX1iM.cjs} +4 -4
- package/dist/brepjs.cjs +24 -24
- package/dist/brepjs.js +24 -24
- package/dist/{cameraFns-CQkS1TSY.js → cameraFns-5FSJmH9r.js} +2 -2
- package/dist/{cameraFns-CqplcvtL.cjs → cameraFns-Bz11Ik2z.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-CE1b1IMu.js → cornerFinder-C10oNGL4.js} +1 -1
- package/dist/{cornerFinder-ByEss8KB.cjs → cornerFinder-mD9AqCfR.cjs} +1 -1
- package/dist/{curveFns-vZbW7CVb.js → curveFns-BcS0DZLj.js} +1 -1
- package/dist/{curveFns-Dx9ha0n_.cjs → curveFns-DOW3Rs1A.cjs} +1 -1
- package/dist/{drawFns-DiJFFH16.js → drawFns-0ojbwK2X.js} +12 -12
- package/dist/{drawFns-ZPhrUGWl.cjs → drawFns-B4BFzsPq.cjs} +12 -12
- package/dist/{extrudeFns-BamV4cSU.js → extrudeFns-CrTb7bjb.js} +1 -1
- package/dist/{extrudeFns-DsvQYfqd.cjs → extrudeFns-D0IrXWsB.cjs} +1 -1
- package/dist/{faceFns-LJ_lU5IE.js → faceFns-DFbEW9oz.js} +2 -2
- package/dist/{faceFns-DGmQI57P.cjs → faceFns-FVl-7nu7.cjs} +2 -2
- package/dist/{helpers-B6abm0X7.cjs → helpers-BqrszPEI.cjs} +6 -6
- package/dist/{helpers-CxZqc5vt.js → helpers-CIucvYwe.js} +6 -6
- package/dist/{historyFns-a2plj33G.cjs → historyFns-B-C4Cp9C.cjs} +4 -4
- package/dist/{historyFns-DpHCn1yw.js → historyFns-h6FtvY5t.js} +4 -4
- package/dist/{importFns-CEz6N0mP.js → importFns-8wNWf6zt.js} +2 -2
- package/dist/{importFns-iJZHFevB.cjs → importFns-Q9jZUGn_.cjs} +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/manifold/curveDesc.d.ts +54 -0
- package/dist/kernel/manifold/profileOps.d.ts +1 -0
- package/dist/{measureFns-CvAOj_Io.cjs → measureFns-DSUJdWbH.cjs} +3 -3
- package/dist/{measureFns-1vEKylTt.js → measureFns-DXQSqDH0.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-D2rlqrTt.cjs → meshFns-D2rcmVr_.cjs} +3 -3
- package/dist/{meshFns-CoPoc7dh.js → meshFns-DZA-Hsya.js} +3 -3
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-Bi22B25-.cjs → primitiveFns-B7BJjuHU.cjs} +7 -7
- package/dist/{primitiveFns-OuEHerl6.js → primitiveFns-_A-uhxX7.js} +7 -7
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{shapeFns-C3wVDhtn.js → shapeFns-Cu8myB5f.js} +2 -2
- package/dist/{shapeFns-n4A9y80v.cjs → shapeFns-Uplvk1Jx.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-eqCfRF0P.cjs → shapeRefFns-DZS2Y-8H.cjs} +4 -4
- package/dist/{shapeRefFns-CUt56Cul.js → shapeRefFns-Drrf8qS4.js} +4 -4
- package/dist/{shapeTypes-C_liO43e.cjs → shapeTypes-0gU7DOBf.cjs} +344 -20
- package/dist/{shapeTypes-9yfC5Z8_.js → shapeTypes-B2tufXyI.js} +344 -20
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-DSAmLmHd.js → solidBuilders-3Is-YjEI.js} +2 -2
- package/dist/{solidBuilders-BtfspzpT.cjs → solidBuilders-CdWC9FZI.cjs} +2 -2
- package/dist/{surfaceBuilders-ChWLM9Io.js → surfaceBuilders-BZOjOk6T.js} +2 -2
- package/dist/{surfaceBuilders-6BfGn0MN.cjs → surfaceBuilders-BjiUI8f_.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-B_RYPM3J.js → textBlueprints-BPi0wGxq.js} +7 -7
- package/dist/{textBlueprints-DTaz774E.cjs → textBlueprints-Dl-qQ5Hm.cjs} +7 -7
- package/dist/{textMetrics-CEBrAzpE.cjs → textMetrics-CDEnxSK0.cjs} +1 -1
- package/dist/{textMetrics-RRDn50ym.js → textMetrics-yWTfUPqx.js} +1 -1
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-B6BTVGLX.cjs → topologyQueryFns-CI4gmFyi.cjs} +1 -1
- package/dist/{topologyQueryFns-nbhh_XJF.js → topologyQueryFns-CxPWWuGB.js} +1 -1
- package/package.json +1 -1
|
@@ -10301,6 +10301,171 @@ function multiplyMatrix(a, b) {
|
|
|
10301
10301
|
return out;
|
|
10302
10302
|
}
|
|
10303
10303
|
//#endregion
|
|
10304
|
+
//#region src/kernel/manifold/curveDesc.ts
|
|
10305
|
+
var TAU = 2 * Math.PI;
|
|
10306
|
+
var hypot3 = (a) => Math.hypot(a[0], a[1], a[2]);
|
|
10307
|
+
var sub3 = (a, b) => [
|
|
10308
|
+
a[0] - b[0],
|
|
10309
|
+
a[1] - b[1],
|
|
10310
|
+
a[2] - b[2]
|
|
10311
|
+
];
|
|
10312
|
+
function lineLen(d) {
|
|
10313
|
+
return hypot3(sub3(d.p2, d.p1));
|
|
10314
|
+
}
|
|
10315
|
+
function bezierAt$1(points, t) {
|
|
10316
|
+
const tmp = points.map((p) => [
|
|
10317
|
+
p[0],
|
|
10318
|
+
p[1],
|
|
10319
|
+
p[2]
|
|
10320
|
+
]);
|
|
10321
|
+
for (let k = 1; k < tmp.length; k++) for (let i = 0; i < tmp.length - k; i++) {
|
|
10322
|
+
const a = tmp[i] ?? [
|
|
10323
|
+
0,
|
|
10324
|
+
0,
|
|
10325
|
+
0
|
|
10326
|
+
];
|
|
10327
|
+
const b = tmp[i + 1] ?? [
|
|
10328
|
+
0,
|
|
10329
|
+
0,
|
|
10330
|
+
0
|
|
10331
|
+
];
|
|
10332
|
+
tmp[i] = [
|
|
10333
|
+
a[0] * (1 - t) + b[0] * t,
|
|
10334
|
+
a[1] * (1 - t) + b[1] * t,
|
|
10335
|
+
a[2] * (1 - t) + b[2] * t
|
|
10336
|
+
];
|
|
10337
|
+
}
|
|
10338
|
+
return tmp[0] ?? [
|
|
10339
|
+
0,
|
|
10340
|
+
0,
|
|
10341
|
+
0
|
|
10342
|
+
];
|
|
10343
|
+
}
|
|
10344
|
+
function descType(d) {
|
|
10345
|
+
if (d.k === "line") return "LINE";
|
|
10346
|
+
if (d.k === "bezier") return "BEZIER";
|
|
10347
|
+
if (d.k === "helix") return "BSPLINE";
|
|
10348
|
+
return Math.abs(d.rx - d.ry) < 1e-9 * Math.max(1, d.rx) ? "CIRCLE" : "ELLIPSE";
|
|
10349
|
+
}
|
|
10350
|
+
/** Parameter bounds: line → [0, length]; conic → [a0, a1]; helix → [0, 2π·turns]; bezier → [0, 1]. */
|
|
10351
|
+
function descBounds(d) {
|
|
10352
|
+
if (d.k === "line") return {
|
|
10353
|
+
first: 0,
|
|
10354
|
+
last: lineLen(d)
|
|
10355
|
+
};
|
|
10356
|
+
if (d.k === "conic") return {
|
|
10357
|
+
first: d.a0,
|
|
10358
|
+
last: d.a1
|
|
10359
|
+
};
|
|
10360
|
+
if (d.k === "helix") return {
|
|
10361
|
+
first: 0,
|
|
10362
|
+
last: TAU * d.turns
|
|
10363
|
+
};
|
|
10364
|
+
return {
|
|
10365
|
+
first: 0,
|
|
10366
|
+
last: 1
|
|
10367
|
+
};
|
|
10368
|
+
}
|
|
10369
|
+
function descPointAt(d, param) {
|
|
10370
|
+
if (d.k === "line") {
|
|
10371
|
+
const t = param / (lineLen(d) || 1);
|
|
10372
|
+
return [
|
|
10373
|
+
d.p1[0] + (d.p2[0] - d.p1[0]) * t,
|
|
10374
|
+
d.p1[1] + (d.p2[1] - d.p1[1]) * t,
|
|
10375
|
+
d.p1[2] + (d.p2[2] - d.p1[2]) * t
|
|
10376
|
+
];
|
|
10377
|
+
}
|
|
10378
|
+
if (d.k === "bezier") return bezierAt$1(d.points, param);
|
|
10379
|
+
if (d.k === "helix") {
|
|
10380
|
+
const ct = Math.cos(param);
|
|
10381
|
+
const st = Math.sin(param);
|
|
10382
|
+
const z = d.pitch * param / TAU;
|
|
10383
|
+
return [
|
|
10384
|
+
d.center[0] + d.radius * (ct * d.x[0] + st * d.y[0]) + z * d.axis[0],
|
|
10385
|
+
d.center[1] + d.radius * (ct * d.x[1] + st * d.y[1]) + z * d.axis[1],
|
|
10386
|
+
d.center[2] + d.radius * (ct * d.x[2] + st * d.y[2]) + z * d.axis[2]
|
|
10387
|
+
];
|
|
10388
|
+
}
|
|
10389
|
+
const ct = Math.cos(param);
|
|
10390
|
+
const st = Math.sin(param);
|
|
10391
|
+
return [
|
|
10392
|
+
d.center[0] + d.rx * ct * d.x[0] + d.ry * st * d.y[0],
|
|
10393
|
+
d.center[1] + d.rx * ct * d.x[1] + d.ry * st * d.y[1],
|
|
10394
|
+
d.center[2] + d.rx * ct * d.x[2] + d.ry * st * d.y[2]
|
|
10395
|
+
];
|
|
10396
|
+
}
|
|
10397
|
+
function descTangent(d, param) {
|
|
10398
|
+
let t;
|
|
10399
|
+
if (d.k === "line") t = sub3(d.p2, d.p1);
|
|
10400
|
+
else if (d.k === "bezier") {
|
|
10401
|
+
const a = bezierAt$1(d.points, Math.max(0, param - 1e-4));
|
|
10402
|
+
t = sub3(bezierAt$1(d.points, Math.min(1, param + 1e-4)), a);
|
|
10403
|
+
} else if (d.k === "helix") {
|
|
10404
|
+
const ct = Math.cos(param);
|
|
10405
|
+
const st = Math.sin(param);
|
|
10406
|
+
const k = d.pitch / TAU;
|
|
10407
|
+
t = [
|
|
10408
|
+
d.radius * (-st * d.x[0] + ct * d.y[0]) + k * d.axis[0],
|
|
10409
|
+
d.radius * (-st * d.x[1] + ct * d.y[1]) + k * d.axis[1],
|
|
10410
|
+
d.radius * (-st * d.x[2] + ct * d.y[2]) + k * d.axis[2]
|
|
10411
|
+
];
|
|
10412
|
+
} else {
|
|
10413
|
+
const ct = Math.cos(param);
|
|
10414
|
+
const st = Math.sin(param);
|
|
10415
|
+
t = [
|
|
10416
|
+
-d.rx * st * d.x[0] + d.ry * ct * d.y[0],
|
|
10417
|
+
-d.rx * st * d.x[1] + d.ry * ct * d.y[1],
|
|
10418
|
+
-d.rx * st * d.x[2] + d.ry * ct * d.y[2]
|
|
10419
|
+
];
|
|
10420
|
+
}
|
|
10421
|
+
const l = hypot3(t) || 1;
|
|
10422
|
+
return [
|
|
10423
|
+
t[0] / l,
|
|
10424
|
+
t[1] / l,
|
|
10425
|
+
t[2] / l
|
|
10426
|
+
];
|
|
10427
|
+
}
|
|
10428
|
+
/** Exact length where closed-form exists; Ramanujan for full ellipses; numeric otherwise. */
|
|
10429
|
+
function descLength(d) {
|
|
10430
|
+
if (d.k === "line") return lineLen(d);
|
|
10431
|
+
if (d.k === "helix") {
|
|
10432
|
+
const c = TAU * d.radius;
|
|
10433
|
+
return d.turns * Math.sqrt(c * c + d.pitch * d.pitch);
|
|
10434
|
+
}
|
|
10435
|
+
if (d.k === "conic") {
|
|
10436
|
+
const span = Math.abs(d.a1 - d.a0);
|
|
10437
|
+
if (Math.abs(d.rx - d.ry) < 1e-9 * Math.max(1, d.rx)) return d.rx * span;
|
|
10438
|
+
if (Math.abs(span - TAU) < 1e-9) {
|
|
10439
|
+
const a = d.rx;
|
|
10440
|
+
const b = d.ry;
|
|
10441
|
+
const h = (a - b) * (a - b) / ((a + b) * (a + b));
|
|
10442
|
+
return Math.PI * (a + b) * (1 + 3 * h / (10 + Math.sqrt(4 - 3 * h)));
|
|
10443
|
+
}
|
|
10444
|
+
return numericLength((t) => descPointAt(d, t), d.a0, d.a1, 256);
|
|
10445
|
+
}
|
|
10446
|
+
return numericLength((t) => descPointAt(d, t), 0, 1, 128);
|
|
10447
|
+
}
|
|
10448
|
+
function descIsClosed(d) {
|
|
10449
|
+
if (d.k === "conic") return Math.abs(Math.abs(d.a1 - d.a0) - TAU) < 1e-9;
|
|
10450
|
+
return false;
|
|
10451
|
+
}
|
|
10452
|
+
function descIsPeriodic(d) {
|
|
10453
|
+
return descIsClosed(d);
|
|
10454
|
+
}
|
|
10455
|
+
function descPeriod(d) {
|
|
10456
|
+
return d.k === "conic" ? TAU : 0;
|
|
10457
|
+
}
|
|
10458
|
+
function numericLength(at, t0, t1, n) {
|
|
10459
|
+
let len = 0;
|
|
10460
|
+
let prev = at(t0);
|
|
10461
|
+
for (let i = 1; i <= n; i++) {
|
|
10462
|
+
const p = at(t0 + (t1 - t0) * i / n);
|
|
10463
|
+
len += hypot3(sub3(p, prev));
|
|
10464
|
+
prev = p;
|
|
10465
|
+
}
|
|
10466
|
+
return len;
|
|
10467
|
+
}
|
|
10468
|
+
//#endregion
|
|
10304
10469
|
//#region src/kernel/manifold/approximations.ts
|
|
10305
10470
|
function asShape$2(shape) {
|
|
10306
10471
|
return shape;
|
|
@@ -10876,8 +11041,51 @@ function discretizeOcctWire(occt, wire) {
|
|
|
10876
11041
|
return chainEdges(occt.iterShapes(wire, "edge").map((e) => sampleOcctEdge(occt, e)));
|
|
10877
11042
|
}
|
|
10878
11043
|
function makeProfileBuilders(_module) {
|
|
10879
|
-
function edge(pts) {
|
|
10880
|
-
return wrap(PLACEHOLDER, makeNode("profileEdge",
|
|
11044
|
+
function edge(pts, curve) {
|
|
11045
|
+
return wrap(PLACEHOLDER, makeNode("profileEdge", curve ? {
|
|
11046
|
+
pts,
|
|
11047
|
+
curve
|
|
11048
|
+
} : { pts }, []));
|
|
11049
|
+
}
|
|
11050
|
+
/** In-plane orthonormal frame (x, y) for a conic on a plane with the given normal. */
|
|
11051
|
+
function conicFrame(normal, xDir) {
|
|
11052
|
+
const n = normalize3(normal);
|
|
11053
|
+
const x = xDir ? normalize3(xDir) : pickPerp(n);
|
|
11054
|
+
return {
|
|
11055
|
+
x,
|
|
11056
|
+
y: normalize3(cross(n, x))
|
|
11057
|
+
};
|
|
11058
|
+
}
|
|
11059
|
+
/** Analytic conic descriptor for the circle through three points (or null if collinear). */
|
|
11060
|
+
function conicDescFrom3(p1, p2, p3) {
|
|
11061
|
+
const v1 = sub(p2, p1);
|
|
11062
|
+
const v2 = sub(p3, p1);
|
|
11063
|
+
const n = cross(v1, v2);
|
|
11064
|
+
if (length3(n) < 1e-12) return void 0;
|
|
11065
|
+
const nn = normalize3(n);
|
|
11066
|
+
const b = dot(v1, v1);
|
|
11067
|
+
const c = dot(v2, v2);
|
|
11068
|
+
const dd = dot(v1, v2);
|
|
11069
|
+
const denom = 2 * (b * c - dd * dd);
|
|
11070
|
+
if (Math.abs(denom) < 1e-18) return void 0;
|
|
11071
|
+
const s = c * (b - dd) / denom;
|
|
11072
|
+
const t = b * (c - dd) / denom;
|
|
11073
|
+
const center = add(p1, add(scaleVec(v1, s), scaleVec(v2, t)));
|
|
11074
|
+
const radius = length3(sub(p1, center));
|
|
11075
|
+
const x = normalize3(sub(p1, center));
|
|
11076
|
+
const y = normalize3(cross(nn, x));
|
|
11077
|
+
let a1 = Math.atan2(dot(sub(p3, center), y), dot(sub(p3, center), x));
|
|
11078
|
+
if (a1 < 0) a1 += 2 * Math.PI;
|
|
11079
|
+
return {
|
|
11080
|
+
k: "conic",
|
|
11081
|
+
center,
|
|
11082
|
+
x,
|
|
11083
|
+
y,
|
|
11084
|
+
rx: radius,
|
|
11085
|
+
ry: radius,
|
|
11086
|
+
a0: 0,
|
|
11087
|
+
a1
|
|
11088
|
+
};
|
|
10881
11089
|
}
|
|
10882
11090
|
function ringOrPts(shape) {
|
|
10883
11091
|
const ms = asManifoldShape(shape);
|
|
@@ -10977,13 +11185,89 @@ function makeProfileBuilders(_module) {
|
|
|
10977
11185
|
y,
|
|
10978
11186
|
z
|
|
10979
11187
|
]]),
|
|
10980
|
-
makeLineEdge: (p1, p2) => edge([p1, p2]
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
11188
|
+
makeLineEdge: (p1, p2) => edge([p1, p2], {
|
|
11189
|
+
k: "line",
|
|
11190
|
+
p1,
|
|
11191
|
+
p2
|
|
11192
|
+
}),
|
|
11193
|
+
makeCircleEdge: (center, normal, radius) => {
|
|
11194
|
+
const { x, y } = conicFrame(normal);
|
|
11195
|
+
return edge(sampleArc(center, normal, radius, 0, 2 * Math.PI), {
|
|
11196
|
+
k: "conic",
|
|
11197
|
+
center,
|
|
11198
|
+
x,
|
|
11199
|
+
y,
|
|
11200
|
+
rx: radius,
|
|
11201
|
+
ry: radius,
|
|
11202
|
+
a0: 0,
|
|
11203
|
+
a1: 2 * Math.PI
|
|
11204
|
+
});
|
|
11205
|
+
},
|
|
11206
|
+
makeCircleArc: (center, normal, radius, startAngle, endAngle) => {
|
|
11207
|
+
const { x, y } = conicFrame(normal);
|
|
11208
|
+
return edge(sampleArc(center, normal, radius, startAngle, endAngle), {
|
|
11209
|
+
k: "conic",
|
|
11210
|
+
center,
|
|
11211
|
+
x,
|
|
11212
|
+
y,
|
|
11213
|
+
rx: radius,
|
|
11214
|
+
ry: radius,
|
|
11215
|
+
a0: startAngle,
|
|
11216
|
+
a1: endAngle
|
|
11217
|
+
});
|
|
11218
|
+
},
|
|
11219
|
+
makeArcEdge: (p1, p2, p3) => edge(circleFrom3(p1, p2, p3), conicDescFrom3(p1, p2, p3)),
|
|
11220
|
+
makeEllipseEdge: (center, normal, majorRadius, minorRadius, xDir) => {
|
|
11221
|
+
const { x, y } = conicFrame(normal, xDir);
|
|
11222
|
+
return edge(ellipsePts(center, normal, majorRadius, minorRadius, xDir), {
|
|
11223
|
+
k: "conic",
|
|
11224
|
+
center,
|
|
11225
|
+
x,
|
|
11226
|
+
y,
|
|
11227
|
+
rx: majorRadius,
|
|
11228
|
+
ry: minorRadius,
|
|
11229
|
+
a0: 0,
|
|
11230
|
+
a1: 2 * Math.PI
|
|
11231
|
+
});
|
|
11232
|
+
},
|
|
11233
|
+
makeBezierEdge: (points) => edge(sampleBezier(points), {
|
|
11234
|
+
k: "bezier",
|
|
11235
|
+
points: points.map((p) => [...p])
|
|
11236
|
+
}),
|
|
11237
|
+
makeTangentArc: (startPoint, _startTangent, endPoint) => edge([startPoint, endPoint], {
|
|
11238
|
+
k: "line",
|
|
11239
|
+
p1: startPoint,
|
|
11240
|
+
p2: endPoint
|
|
11241
|
+
}),
|
|
11242
|
+
makeHelixWire: (pitch, height, radius, center = [
|
|
11243
|
+
0,
|
|
11244
|
+
0,
|
|
11245
|
+
0
|
|
11246
|
+
], direction = [
|
|
11247
|
+
0,
|
|
11248
|
+
0,
|
|
11249
|
+
1
|
|
11250
|
+
], leftHanded = false) => {
|
|
11251
|
+
const axis = normalize3(direction);
|
|
11252
|
+
const x = pickPerp(axis);
|
|
11253
|
+
const y0 = normalize3(cross(axis, x));
|
|
11254
|
+
const y = leftHanded ? scaleVec(y0, -1) : y0;
|
|
11255
|
+
const turns = pitch !== 0 ? height / pitch : 0;
|
|
11256
|
+
const desc = {
|
|
11257
|
+
k: "helix",
|
|
11258
|
+
center,
|
|
11259
|
+
axis,
|
|
11260
|
+
x,
|
|
11261
|
+
y,
|
|
11262
|
+
radius,
|
|
11263
|
+
pitch,
|
|
11264
|
+
turns
|
|
11265
|
+
};
|
|
11266
|
+
const segs = Math.max(8, Math.ceil(turns * FULL_CIRCLE_SEGMENTS));
|
|
11267
|
+
const pts = [];
|
|
11268
|
+
for (let i = 0; i <= segs; i++) pts.push(descPointAt(desc, 2 * Math.PI * turns * i / segs));
|
|
11269
|
+
return edge(pts, desc);
|
|
11270
|
+
},
|
|
10987
11271
|
makeWire: (edges) => wireFrom(edges),
|
|
10988
11272
|
makeWireFromMixed: (items) => wireFrom(items),
|
|
10989
11273
|
makeFace,
|
|
@@ -11029,7 +11313,7 @@ function makeBuilderOps(module) {
|
|
|
11029
11313
|
makeEllipseArc: () => notImplemented("makeEllipseArc"),
|
|
11030
11314
|
makeBezierEdge: (points) => profile.makeBezierEdge(points),
|
|
11031
11315
|
makeTangentArc: (startPoint, startTangent, endPoint) => profile.makeTangentArc(startPoint, startTangent, endPoint),
|
|
11032
|
-
makeHelixWire: () =>
|
|
11316
|
+
makeHelixWire: (pitch, height, radius, center, direction, leftHanded) => profile.makeHelixWire(pitch, height, radius, center, direction, leftHanded),
|
|
11033
11317
|
makeWireFromMixed: (items) => profile.makeWireFromMixed(items),
|
|
11034
11318
|
makeCompound: () => notImplemented("makeCompound"),
|
|
11035
11319
|
solidFromShell: () => notImplemented("solidFromShell"),
|
|
@@ -12621,6 +12905,8 @@ function makeMeasureOps(_module) {
|
|
|
12621
12905
|
length: (shape) => {
|
|
12622
12906
|
const e = shape;
|
|
12623
12907
|
if (e && e.__nativeEdge && typeof e.length === "number") return e.length;
|
|
12908
|
+
const node = asManifoldShape(shape)?.node;
|
|
12909
|
+
if (node?.op === "profileEdge" && node.params?.curve) return descLength(node.params.curve);
|
|
12624
12910
|
return notImplemented("length");
|
|
12625
12911
|
},
|
|
12626
12912
|
centerOfMass: (shape) => centerOfMass(shape),
|
|
@@ -13785,18 +14071,56 @@ function viaOcct(shape, query) {
|
|
|
13785
14071
|
}
|
|
13786
14072
|
return query(occtShape, occt);
|
|
13787
14073
|
}
|
|
14074
|
+
/** The analytic curve descriptor of a standalone profile edge, if it has one. */
|
|
14075
|
+
function descOf(shape) {
|
|
14076
|
+
const ms = asManifoldShape(shape);
|
|
14077
|
+
if (!ms) return void 0;
|
|
14078
|
+
const node = ms.node;
|
|
14079
|
+
return node.op === "profileEdge" ? node.params?.curve : void 0;
|
|
14080
|
+
}
|
|
13788
14081
|
function makeGeometryOps(_module) {
|
|
13789
14082
|
return {
|
|
13790
|
-
curveType: (shape) =>
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
14083
|
+
curveType: (shape) => {
|
|
14084
|
+
const d = descOf(shape);
|
|
14085
|
+
if (d) return descType(d);
|
|
14086
|
+
return isNativeEdge(shape) ? shape.curveType : viaOcct(shape, (s, occt) => occt.curveType(s));
|
|
14087
|
+
},
|
|
14088
|
+
curveParameters: (shape) => {
|
|
14089
|
+
const d = descOf(shape);
|
|
14090
|
+
if (d) {
|
|
14091
|
+
const b = descBounds(d);
|
|
14092
|
+
return [b.first, b.last];
|
|
14093
|
+
}
|
|
14094
|
+
return isNativeEdge(shape) ? [0, shape.length] : viaOcct(shape, (s, occt) => occt.curveParameters(s));
|
|
14095
|
+
},
|
|
14096
|
+
curvePointAtParam: (shape, param) => {
|
|
14097
|
+
const d = descOf(shape);
|
|
14098
|
+
if (d) return descPointAt(d, param);
|
|
14099
|
+
return isNativeEdge(shape) ? edgePointAt(shape, param) : viaOcct(shape, (s, occt) => occt.curvePointAtParam(s, param));
|
|
14100
|
+
},
|
|
14101
|
+
curveTangent: (shape, param) => {
|
|
14102
|
+
const d = descOf(shape);
|
|
14103
|
+
if (d) return {
|
|
14104
|
+
point: descPointAt(d, param),
|
|
14105
|
+
tangent: descTangent(d, param)
|
|
14106
|
+
};
|
|
14107
|
+
return isNativeEdge(shape) ? {
|
|
14108
|
+
point: edgePointAt(shape, param),
|
|
14109
|
+
tangent: edgeTangentAt(shape, param)
|
|
14110
|
+
} : viaOcct(shape, (s, occt) => occt.curveTangent(s, param));
|
|
14111
|
+
},
|
|
14112
|
+
curveIsClosed: (shape) => {
|
|
14113
|
+
const d = descOf(shape);
|
|
14114
|
+
return d ? descIsClosed(d) : viaOcct(shape, (s, occt) => occt.curveIsClosed(s));
|
|
14115
|
+
},
|
|
14116
|
+
curveIsPeriodic: (shape) => {
|
|
14117
|
+
const d = descOf(shape);
|
|
14118
|
+
return d ? descIsPeriodic(d) : viaOcct(shape, (s, occt) => occt.curveIsPeriodic(s));
|
|
14119
|
+
},
|
|
14120
|
+
curvePeriod: (shape) => {
|
|
14121
|
+
const d = descOf(shape);
|
|
14122
|
+
return d ? descPeriod(d) : viaOcct(shape, (s, occt) => occt.curvePeriod(s));
|
|
14123
|
+
},
|
|
13800
14124
|
interpolatePoints: (points, options) => occtOrThrow("interpolatePoints").interpolatePoints(points, options),
|
|
13801
14125
|
approximatePoints: (points, options) => occtOrThrow("approximatePoints").approximatePoints(points, options),
|
|
13802
14126
|
curveDegreeElevate: (edge, elevateBy) => viaOcct(edge, (s, occt) => occt.curveDegreeElevate(s, elevateBy)),
|