brepjs 18.100.3 → 18.102.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-DZB6Drrd.js → blueprint-CF12Nceg.js} +5 -5
- package/dist/{blueprint-1x01ITBT.cjs → blueprint-D5ArjKiA.cjs} +5 -5
- package/dist/{blueprintFns-o4dhTIZQ.js → blueprintFns-BuPAK4OB.js} +2 -2
- package/dist/{blueprintFns-DkmuKpz6.cjs → blueprintFns-CcCfkbyd.cjs} +2 -2
- package/dist/{blueprintSketcher-C5Q-JLEK.js → blueprintSketcher-CEQ8s7TD.js} +3 -3
- package/dist/{blueprintSketcher-BoHwuwaU.cjs → blueprintSketcher-DCttG3KS.cjs} +3 -3
- package/dist/{boolean2D-DV642GXt.js → boolean2D-8rB2sUzj.js} +4 -4
- package/dist/{boolean2D-C1Akp29q.cjs → boolean2D-BCqDjg0y.cjs} +4 -4
- package/dist/brepjs.cjs +234 -39
- package/dist/brepjs.js +228 -40
- package/dist/{cameraFns-B62EdiYs.js → cameraFns-Bu6jgTKc.js} +2 -2
- package/dist/{cameraFns-B-T9D-ie.cjs → cameraFns-S7YbAxfg.cjs} +2 -2
- package/dist/core/kernelBoundary.d.ts +1 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-Bmjk2BOw.js → cornerFinder-COqoeY--.js} +1 -1
- package/dist/{cornerFinder-CqSNuWBI.cjs → cornerFinder-Ci2NbbAW.cjs} +1 -1
- package/dist/csg/evaluate.d.ts +29 -6
- package/dist/{curveFns-CaEoZJFJ.js → curveFns-CG05Jygr.js} +1 -1
- package/dist/{curveFns-BIlzT4bO.cjs → curveFns-Dx7_wMut.cjs} +1 -1
- package/dist/{drawFns-BVVGRW0h.js → drawFns-CsXPFyDe.js} +12 -12
- package/dist/{drawFns-Dwq6JHbb.cjs → drawFns-DYkjT_hx.cjs} +12 -12
- package/dist/{faceFns-B7yceDjt.cjs → faceFns-DKg2St8b.cjs} +4 -7
- package/dist/{faceFns-CFvc_qXI.js → faceFns-mo4ThIHz.js} +4 -7
- package/dist/{healingFns-BY6Q9gge.js → healingFns-Bb3eEBNm.js} +5 -5
- package/dist/{healingFns-CEzX-45q.cjs → healingFns-CM5mVMow.cjs} +5 -5
- package/dist/{helpers-A0a3O6af.cjs → helpers-8zxf2gkc.cjs} +6 -6
- package/dist/{helpers-BamnXOMX.js → helpers-DT44wBAD.js} +6 -6
- package/dist/{importFns-Dj107tFY.cjs → importFns-B6hw9Nhx.cjs} +3 -3
- package/dist/{importFns-Cfe_tEh_.js → importFns-CEczwPdN.js} +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/brepkitWasmTypes.d.ts +6 -7
- package/dist/kernel/brepkit/kernel2dOps.d.ts +3 -4
- package/dist/kernel/geometry2d.d.ts +2 -0
- package/dist/kernel/occt/kernel2dOps.d.ts +3 -4
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-CFyOO359.cjs → loftFns-DaRDYpfB.cjs} +11 -1
- package/dist/{loftFns-D5rQxNOI.js → loftFns-DyNuD9XL.js} +11 -1
- package/dist/{measureFns-Bb0Do7in.js → measureFns-Dkh_DmrE.js} +3 -3
- package/dist/{measureFns-Cmc_y0WE.cjs → measureFns-Q2dnokUU.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-Bkcg1u5D.js → meshFns-CAAarhVm.js} +3 -3
- package/dist/{meshFns-BKBGgLB4.cjs → meshFns-DeKdpmu7.cjs} +3 -3
- package/dist/{occtWasmAdapter-D7mOxU0Q.js → occtWasmAdapter-BDEPveZs.js} +82 -14
- package/dist/{occtWasmAdapter-Bv2OTOX9.cjs → occtWasmAdapter-DDZELjlB.cjs} +93 -13
- package/dist/operations/extrudeUtils.d.ts +1 -6
- package/dist/operations/instanceFns.d.ts +66 -0
- package/dist/operations/sweepFns.d.ts +1 -7
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-DS7-3evP.js → primitiveFns-62SO4ti5.js} +4 -4
- package/dist/{primitiveFns-B898KlXM.cjs → primitiveFns-BAWtMd9H.cjs} +4 -4
- 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-D-4StVDd.js → shapeFns-DyBbhU30.js} +2 -2
- package/dist/{shapeFns-B3GP-0FJ.cjs → shapeFns-L4a8kH_A.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-DzVlxDhd.js → shapeRefFns-Cn4WNb3q.js} +4 -4
- package/dist/{shapeRefFns-C6L7KhTi.cjs → shapeRefFns-Dij41NuC.cjs} +4 -4
- package/dist/{shapeTypes-DQfoZt_L.cjs → shapeTypes-Bwgm5N6R.cjs} +5 -133
- package/dist/{shapeTypes-z5bfGPVI.js → shapeTypes-C4lPfrc2.js} +3 -131
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-8H08aDto.js → solidBuilders-Biwv2cW3.js} +5 -5
- package/dist/{solidBuilders-B0Uyvvyy.cjs → solidBuilders-CgRmJEdn.cjs} +5 -5
- package/dist/{surfaceBuilders-BYopOndo.js → surfaceBuilders-Bww4jhBo.js} +2 -2
- package/dist/{surfaceBuilders-zGpnLDxz.cjs → surfaceBuilders-FLnYYA70.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-B8cDsSHe.cjs → textBlueprints-08NcMO9T.cjs} +7 -7
- package/dist/{textBlueprints-ziKppdNm.js → textBlueprints-CEzTC9vX.js} +7 -7
- package/dist/{textMetrics-CP-jrZ98.js → textMetrics-CBbDQ5QW.js} +1 -1
- package/dist/{textMetrics-B8qEy3dh.cjs → textMetrics-W-H6jUDj.cjs} +1 -1
- package/dist/{threadFns-7jlwHbES.js → threadFns-8rKpQXiR.js} +6 -6
- package/dist/{threadFns-B_8tna0V.cjs → threadFns-DGYdomjN.cjs} +6 -6
- package/dist/topology.cjs +8 -8
- package/dist/topology.js +8 -8
- package/dist/{topologyQueryFns-De27Nxmf.js → topologyQueryFns-Do8E4EXj.js} +1 -1
- package/dist/{topologyQueryFns-BLkQkExs.cjs → topologyQueryFns-ygBBXxnP.cjs} +1 -1
- package/package.json +2 -2
|
@@ -392,6 +392,70 @@ function makeCircle2d$1(cx, cy, radius, sense = true) {
|
|
|
392
392
|
sense
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
+
function makeArc2dThreePoints$1(x1, y1, xm, ym, x2, y2) {
|
|
396
|
+
const d = 2 * (x1 * (ym - y2) + xm * (y2 - y1) + x2 * (y1 - ym));
|
|
397
|
+
if (Math.abs(d) < 1e-12) return makeLine2d$1(x1, y1, x2, y2);
|
|
398
|
+
const cx = ((x1 * x1 + y1 * y1) * (ym - y2) + (xm * xm + ym * ym) * (y2 - y1) + (x2 * x2 + y2 * y2) * (y1 - ym)) / d;
|
|
399
|
+
const cy = ((x1 * x1 + y1 * y1) * (x2 - xm) + (xm * xm + ym * ym) * (x1 - x2) + (x2 * x2 + y2 * y2) * (xm - x1)) / d;
|
|
400
|
+
const radius = Math.sqrt((x1 - cx) ** 2 + (y1 - cy) ** 2);
|
|
401
|
+
const a1 = Math.atan2(y1 - cy, x1 - cx);
|
|
402
|
+
const am = Math.atan2(ym - cy, xm - cx);
|
|
403
|
+
const a2 = Math.atan2(y2 - cy, x2 - cx);
|
|
404
|
+
let da1m = am - a1;
|
|
405
|
+
if (da1m < 0) da1m += 2 * Math.PI;
|
|
406
|
+
let da12 = a2 - a1;
|
|
407
|
+
if (da12 < 0) da12 += 2 * Math.PI;
|
|
408
|
+
const sense = da1m < da12;
|
|
409
|
+
const circle = makeCircle2d$1(cx, cy, radius, sense);
|
|
410
|
+
if (!sense) {
|
|
411
|
+
const tStart = -a1;
|
|
412
|
+
let tEnd = -a2;
|
|
413
|
+
if (tEnd < tStart - 1e-9) tEnd += 2 * Math.PI;
|
|
414
|
+
return {
|
|
415
|
+
__bk2d: "trimmed",
|
|
416
|
+
basis: circle,
|
|
417
|
+
tStart,
|
|
418
|
+
tEnd
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
let tEnd = a2;
|
|
422
|
+
if (tEnd < a1 - 1e-9) tEnd += 2 * Math.PI;
|
|
423
|
+
return {
|
|
424
|
+
__bk2d: "trimmed",
|
|
425
|
+
basis: circle,
|
|
426
|
+
tStart: a1,
|
|
427
|
+
tEnd
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function makeArc2dTangent$1(sx, sy, tx, ty, ex, ey) {
|
|
431
|
+
const len = Math.sqrt(tx * tx + ty * ty);
|
|
432
|
+
const ntx = len > 0 ? tx / len : 0;
|
|
433
|
+
const nty = len > 0 ? ty / len : 0;
|
|
434
|
+
const dx = sx - ex;
|
|
435
|
+
const dy = sy - ey;
|
|
436
|
+
const denom = 2 * (dy * ntx - dx * nty);
|
|
437
|
+
if (Math.abs(denom) < 1e-12) return makeLine2d$1(sx, sy, ex, ey);
|
|
438
|
+
const t = -(dx * dx + dy * dy) / denom;
|
|
439
|
+
const cx = sx - t * nty;
|
|
440
|
+
const cy = sy + t * ntx;
|
|
441
|
+
const radius = Math.abs(t);
|
|
442
|
+
const a1 = Math.atan2(sy - cy, sx - cx);
|
|
443
|
+
const a2 = Math.atan2(ey - cy, ex - cx);
|
|
444
|
+
const ccwTanX = -(sy - cy) / radius;
|
|
445
|
+
const ccwTanY = (sx - cx) / radius;
|
|
446
|
+
const dotCcw = ntx * ccwTanX + nty * ccwTanY;
|
|
447
|
+
let aMid;
|
|
448
|
+
if (dotCcw > 0) {
|
|
449
|
+
let da = a2 - a1;
|
|
450
|
+
if (da <= 0) da += 2 * Math.PI;
|
|
451
|
+
aMid = a1 + da / 2;
|
|
452
|
+
} else {
|
|
453
|
+
let da = a2 - a1;
|
|
454
|
+
if (da >= 0) da -= 2 * Math.PI;
|
|
455
|
+
aMid = a1 + da / 2;
|
|
456
|
+
}
|
|
457
|
+
return makeArc2dThreePoints$1(sx, sy, cx + radius * Math.cos(aMid), cy + radius * Math.sin(aMid), ex, ey);
|
|
458
|
+
}
|
|
395
459
|
function makeEllipse2d$1(cx, cy, majorRadius, minorRadius, xDirX = 1, xDirY = 0, sense = true) {
|
|
396
460
|
return {
|
|
397
461
|
__bk2d: "ellipse",
|
|
@@ -3621,7 +3685,7 @@ function getCurve2dBounds(curve) {
|
|
|
3621
3685
|
}
|
|
3622
3686
|
function getCurve2dType(curve) {
|
|
3623
3687
|
let cu = c2d(curve);
|
|
3624
|
-
while (cu.__bk2d === "trimmed"
|
|
3688
|
+
while (cu.__bk2d === "trimmed") cu = cu.basis;
|
|
3625
3689
|
return curveTypeName(cu);
|
|
3626
3690
|
}
|
|
3627
3691
|
function trimCurve2d(curve, start, end) {
|
|
@@ -3810,7 +3874,7 @@ function projectPointOnCurve2d(curve, x, y) {
|
|
|
3810
3874
|
distance: Math.sqrt(bestDist)
|
|
3811
3875
|
};
|
|
3812
3876
|
};
|
|
3813
|
-
if (c.__bk2d === "trimmed"
|
|
3877
|
+
if (c.__bk2d === "trimmed") {
|
|
3814
3878
|
const tStart = c.tStart;
|
|
3815
3879
|
const tEnd = c.tEnd;
|
|
3816
3880
|
const basisResult = projectOnBasis(c.basis, tStart, tEnd);
|
|
@@ -3872,12 +3936,16 @@ function approximateCurve2dAsBSpline(curve, maxSegments) {
|
|
|
3872
3936
|
}
|
|
3873
3937
|
function decomposeBSpline2dToBeziers(curve) {
|
|
3874
3938
|
let cu = c2d(curve);
|
|
3875
|
-
while (cu.__bk2d === "trimmed"
|
|
3939
|
+
while (cu.__bk2d === "trimmed") cu = cu.basis;
|
|
3876
3940
|
if (cu.__bk2d !== "bspline") return [curve];
|
|
3877
3941
|
const poles = cu.poles;
|
|
3878
3942
|
const p = cu.degree;
|
|
3879
3943
|
const U = [];
|
|
3880
|
-
for (let i = 0; i < cu.knots.length; i++)
|
|
3944
|
+
for (let i = 0; i < cu.knots.length; i++) {
|
|
3945
|
+
const knot = cu.knots[i] ?? 0;
|
|
3946
|
+
const mult = cu.multiplicities[i] ?? 0;
|
|
3947
|
+
for (let j = 0; j < mult; j++) U.push(knot);
|
|
3948
|
+
}
|
|
3881
3949
|
const m = poles.length - 1 + p + 1;
|
|
3882
3950
|
if (p < 1 || U.length !== m + 1) return [c2dWrap(makeBezier2d$1(poles))];
|
|
3883
3951
|
const clone = (pt) => [pt[0], pt[1]];
|
|
@@ -3947,36 +4015,36 @@ function isBBox2dOutPoint(bbox, x, y) {
|
|
|
3947
4015
|
}
|
|
3948
4016
|
function getCurve2dCircleData(curve) {
|
|
3949
4017
|
let c = c2d(curve);
|
|
3950
|
-
while (c.__bk2d === "trimmed"
|
|
4018
|
+
while (c.__bk2d === "trimmed") c = c.basis;
|
|
3951
4019
|
if (c.__bk2d === "circle") return {
|
|
3952
4020
|
cx: c.cx,
|
|
3953
4021
|
cy: c.cy,
|
|
3954
4022
|
radius: c.radius,
|
|
3955
|
-
isDirect: c.sense
|
|
4023
|
+
isDirect: c.sense
|
|
3956
4024
|
};
|
|
3957
4025
|
return null;
|
|
3958
4026
|
}
|
|
3959
4027
|
function getCurve2dEllipseData(curve) {
|
|
3960
4028
|
let c = c2d(curve);
|
|
3961
|
-
while (c.__bk2d === "trimmed"
|
|
4029
|
+
while (c.__bk2d === "trimmed") c = c.basis;
|
|
3962
4030
|
if (c.__bk2d === "ellipse") return {
|
|
3963
4031
|
majorRadius: c.majorRadius,
|
|
3964
4032
|
minorRadius: c.minorRadius,
|
|
3965
|
-
xAxisAngle: c.xDirAngle
|
|
3966
|
-
isDirect: c.sense
|
|
4033
|
+
xAxisAngle: c.xDirAngle,
|
|
4034
|
+
isDirect: c.sense
|
|
3967
4035
|
};
|
|
3968
4036
|
return null;
|
|
3969
4037
|
}
|
|
3970
4038
|
function getCurve2dBezierPoles(curve) {
|
|
3971
4039
|
let c = c2d(curve);
|
|
3972
|
-
while (c.__bk2d === "trimmed"
|
|
3973
|
-
if (c.__bk2d === "bezier"
|
|
4040
|
+
while (c.__bk2d === "trimmed") c = c.basis;
|
|
4041
|
+
if (c.__bk2d === "bezier") return c.poles;
|
|
3974
4042
|
return null;
|
|
3975
4043
|
}
|
|
3976
4044
|
function getCurve2dBezierDegree(curve) {
|
|
3977
4045
|
let c = c2d(curve);
|
|
3978
|
-
while (c.__bk2d === "trimmed"
|
|
3979
|
-
if (c
|
|
4046
|
+
while (c.__bk2d === "trimmed") c = c.basis;
|
|
4047
|
+
if (c.__bk2d === "bezier") return c.poles.length - 1;
|
|
3980
4048
|
return null;
|
|
3981
4049
|
}
|
|
3982
4050
|
function serializeCurve2d(curve) {
|
|
@@ -5311,6 +5379,18 @@ Object.defineProperty(exports, "intersectCurves2dFn", {
|
|
|
5311
5379
|
return intersectCurves2dFn;
|
|
5312
5380
|
}
|
|
5313
5381
|
});
|
|
5382
|
+
Object.defineProperty(exports, "makeArc2dTangent", {
|
|
5383
|
+
enumerable: true,
|
|
5384
|
+
get: function() {
|
|
5385
|
+
return makeArc2dTangent$1;
|
|
5386
|
+
}
|
|
5387
|
+
});
|
|
5388
|
+
Object.defineProperty(exports, "makeArc2dThreePoints", {
|
|
5389
|
+
enumerable: true,
|
|
5390
|
+
get: function() {
|
|
5391
|
+
return makeArc2dThreePoints$1;
|
|
5392
|
+
}
|
|
5393
|
+
});
|
|
5314
5394
|
Object.defineProperty(exports, "makeBezier2d", {
|
|
5315
5395
|
enumerable: true,
|
|
5316
5396
|
get: function() {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import { KernelType } from '../kernel/types.js';
|
|
1
2
|
import { Result } from '../core/result.js';
|
|
2
|
-
/**
|
|
3
|
-
* Shared utilities for extrusion operations.
|
|
4
|
-
* Used by both class-based (extrude.ts) and functional (extrudeFns.ts) APIs.
|
|
5
|
-
*/
|
|
6
|
-
type KernelType = any;
|
|
7
3
|
/** Configuration for sweep/pipe operations along a spine. */
|
|
8
4
|
export interface SweepOptions {
|
|
9
5
|
/** Use Frenet trihedron for profile orientation */
|
|
@@ -60,4 +56,3 @@ export interface ExtrusionProfile {
|
|
|
60
56
|
* if the profile type is unsupported.
|
|
61
57
|
*/
|
|
62
58
|
export declare function buildLawFromProfile(extrusionLength: number, { profile, endFactor }: ExtrusionProfile): Result<KernelType>;
|
|
63
|
-
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Result } from '../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../core/shapeTypes.js';
|
|
3
|
+
import { Matrix4x4, Vec3 } from '../core/types.js';
|
|
4
|
+
import { ShapeMesh, MeshOptions } from '../topology/meshFns.js';
|
|
5
|
+
/** Grid provenance, set by `instanceGrid`, lets `materialize({fuse})` route
|
|
6
|
+
* through the faster kernel `gridPattern` path instead of fusing N copies. */
|
|
7
|
+
interface GridSpec {
|
|
8
|
+
readonly cols: number;
|
|
9
|
+
readonly rows: number;
|
|
10
|
+
readonly pitchX: number;
|
|
11
|
+
readonly pitchY: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One source shape replicated across N placements. Not a kernel-backed shape
|
|
15
|
+
* (no `.wrapped`) — an app-level container that owns the single source handle.
|
|
16
|
+
*/
|
|
17
|
+
export interface InstancedShape<D extends Dimension = '3D'> extends Disposable {
|
|
18
|
+
readonly __instanced: true;
|
|
19
|
+
/** The single shared source shape (owned — disposed with this container). */
|
|
20
|
+
readonly source: AnyShape<D>;
|
|
21
|
+
/** Per-instance world transforms (row-major 4x4). */
|
|
22
|
+
readonly placements: ReadonlyArray<Matrix4x4>;
|
|
23
|
+
/** Present when built by `instanceGrid` — enables the gridPattern fuse path. */
|
|
24
|
+
readonly grid?: GridSpec | undefined;
|
|
25
|
+
[Symbol.dispose](): void;
|
|
26
|
+
}
|
|
27
|
+
/** Type guard for an InstancedShape. */
|
|
28
|
+
export declare function isInstanced(x: unknown): x is InstancedShape<Dimension>;
|
|
29
|
+
/**
|
|
30
|
+
* Instance a shape across explicit placements. `Vec3[]` is translate-only sugar
|
|
31
|
+
* for `Matrix4x4[]`. The source is owned by the returned container.
|
|
32
|
+
*/
|
|
33
|
+
export declare function instance<D extends Dimension>(source: AnyShape<D>, placements: readonly Matrix4x4[] | readonly Vec3[]): InstancedShape<D>;
|
|
34
|
+
export interface InstanceGridOptions {
|
|
35
|
+
readonly cols: number;
|
|
36
|
+
readonly rows: number;
|
|
37
|
+
readonly pitchX: number;
|
|
38
|
+
readonly pitchY: number;
|
|
39
|
+
}
|
|
40
|
+
/** Instance a shape across a cols x rows grid in the XY plane. */
|
|
41
|
+
export declare function instanceGrid<D extends Dimension>(source: AnyShape<D>, opts: InstanceGridOptions): InstancedShape<D>;
|
|
42
|
+
/** Number of placements. */
|
|
43
|
+
export declare function instanceCount(inst: InstancedShape<Dimension>): number;
|
|
44
|
+
export interface MaterializeOptions {
|
|
45
|
+
/** Fuse the placed copies into a single solid (3D only). Default: false —
|
|
46
|
+
* returns a Compound of separate placed parts. */
|
|
47
|
+
readonly fuse?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Produce real geometry: a Compound of N placed copies (default), or a single
|
|
51
|
+
* fused solid (`fuse: true`, 3D only). This is where the N kernel transforms
|
|
52
|
+
* happen. A grid-built instance fuses via the faster kernel `gridPattern`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function materialize<D extends Dimension>(inst: InstancedShape<D>, opts?: MaterializeOptions): Result<AnyShape<Dimension>>;
|
|
55
|
+
export interface InstancedMesh {
|
|
56
|
+
/** The source shape meshed ONCE. */
|
|
57
|
+
readonly geometry: ShapeMesh;
|
|
58
|
+
/** Per-instance transforms — feed to e.g. three.js InstancedMesh. */
|
|
59
|
+
readonly instances: ReadonlyArray<Matrix4x4>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Mesh the source once and return it alongside the placements — the
|
|
63
|
+
* "one tessellation, N placements" render payload for an instanced draw.
|
|
64
|
+
*/
|
|
65
|
+
export declare function instancedMesh(inst: InstancedShape<Dimension>, opts?: MeshOptions): InstancedMesh;
|
|
66
|
+
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
+
import { KernelType } from '../kernel/types.js';
|
|
1
2
|
import { Vec3 } from '../core/types.js';
|
|
2
3
|
import { ClosedWire, Dimension, Wire, Shell, Solid, Shape3D } from '../core/shapeTypes.js';
|
|
3
4
|
import { Result } from '../core/result.js';
|
|
4
5
|
import { ExtrusionProfile, SweepOptions } from './extrudeUtils.js';
|
|
5
|
-
/**
|
|
6
|
-
* Sweep operations — generic sweep, support extrude, complex extrude,
|
|
7
|
-
* twist extrude, multi-section sweep, and guided sweep.
|
|
8
|
-
*
|
|
9
|
-
* Consolidated from extrudeFns, multiSweepFns, and guidedSweepFns.
|
|
10
|
-
*/
|
|
11
|
-
type KernelType = any;
|
|
12
6
|
export type { ExtrusionProfile, SweepOptions } from './extrudeUtils.js';
|
|
13
7
|
/** Configuration for a single sweep section (profile wire + optional location). */
|
|
14
8
|
export interface SweepSectionConfig {
|
package/dist/operations.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_threadFns = require("./threadFns-
|
|
3
|
-
const require_loftFns = require("./loftFns-
|
|
2
|
+
const require_threadFns = require("./threadFns-DGYdomjN.cjs");
|
|
3
|
+
const require_loftFns = require("./loftFns-DaRDYpfB.cjs");
|
|
4
4
|
exports.addChild = require_threadFns.addChild;
|
|
5
5
|
exports.addJoint = require_threadFns.addJoint;
|
|
6
6
|
exports.addStep = require_threadFns.addStep;
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-
|
|
2
|
-
import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-
|
|
1
|
+
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-8rKpQXiR.js";
|
|
2
|
+
import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-DyNuD9XL.js";
|
|
3
3
|
export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Z as getKernel, c as createSolid, x as isClosedWire } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, c as createSolid, x as isClosedWire } from "./shapeTypes-C4lPfrc2.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, v as andThen } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
4
|
-
import { h as translate } from "./shapeFns-
|
|
5
|
-
import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-
|
|
6
|
-
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-
|
|
4
|
+
import { h as translate } from "./shapeFns-DyBbhU30.js";
|
|
5
|
+
import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-Bww4jhBo.js";
|
|
6
|
+
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-Biwv2cW3.js";
|
|
7
7
|
//#region src/topology/primitiveFns.ts
|
|
8
8
|
/**
|
|
9
9
|
* Create a box with the given dimensions.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-Bwgm5N6R.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
4
|
-
const require_shapeFns = require("./shapeFns-
|
|
5
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
6
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
4
|
+
const require_shapeFns = require("./shapeFns-L4a8kH_A.cjs");
|
|
5
|
+
const require_surfaceBuilders = require("./surfaceBuilders-FLnYYA70.cjs");
|
|
6
|
+
const require_solidBuilders = require("./solidBuilders-CgRmJEdn.cjs");
|
|
7
7
|
//#region src/topology/primitiveFns.ts
|
|
8
8
|
/**
|
|
9
9
|
* Create a box with the given dimensions.
|
package/dist/projection.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cameraFns = require("./cameraFns-
|
|
2
|
+
const require_cameraFns = require("./cameraFns-S7YbAxfg.cjs");
|
|
3
3
|
exports.PROJECTION_PLANES = require_cameraFns.PROJECTION_PLANES;
|
|
4
4
|
exports.cameraFromPlane = require_cameraFns.cameraFromPlane;
|
|
5
5
|
exports.cameraLookAt = require_cameraFns.cameraLookAt;
|
package/dist/projection.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-
|
|
1
|
+
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-Bu6jgTKc.js";
|
|
2
2
|
export { PROJECTION_PLANES, cameraFromPlane, cameraLookAt, createCamera, isProjectionPlane, makeProjectedEdges, projectEdges };
|
package/dist/query.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_helpers = require("./helpers-
|
|
3
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
2
|
+
const require_helpers = require("./helpers-8zxf2gkc.cjs");
|
|
3
|
+
const require_cornerFinder = require("./cornerFinder-Ci2NbbAW.cjs");
|
|
4
4
|
exports.cornerFinder = require_cornerFinder.cornerFinder;
|
|
5
5
|
exports.edgeFinder = require_helpers.edgeFinder;
|
|
6
6
|
exports.faceFinder = require_helpers.faceFinder;
|
package/dist/query.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-
|
|
2
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
1
|
+
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DT44wBAD.js";
|
|
2
|
+
import { t as cornerFinder } from "./cornerFinder-COqoeY--.js";
|
|
3
3
|
export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, t as castShape } from "./shapeTypes-C4lPfrc2.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-
|
|
3
|
+
import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-Do8E4EXj.js";
|
|
4
4
|
import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
5
5
|
//#region src/topology/metadata/originTrackingFns.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-Bwgm5N6R.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-ygBBXxnP.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
5
|
//#region src/topology/metadata/originTrackingFns.ts
|
|
6
6
|
/**
|
package/dist/shapeRef.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shapeRefFns = require("./shapeRefFns-
|
|
2
|
+
const require_shapeRefFns = require("./shapeRefFns-Dij41NuC.cjs");
|
|
3
3
|
exports.assignRoles = require_shapeRefFns.assignRoles;
|
|
4
4
|
exports.captureHint = require_shapeRefFns.captureHint;
|
|
5
5
|
exports.createRef = require_shapeRefFns.createRef;
|
package/dist/shapeRef.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-
|
|
1
|
+
import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-Cn4WNb3q.js";
|
|
2
2
|
export { assignRoles, captureHint, createRef, defaultScorer, resolveRef, updateRoles };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as wasmIndex } from "./vec3-Dpha8d5k.js";
|
|
2
|
-
import { c as getFaces } from "./topologyQueryFns-
|
|
3
|
-
import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-
|
|
4
|
-
import { n as getHashCode } from "./shapeFns-
|
|
5
|
-
import { n as measureArea } from "./measureFns-
|
|
2
|
+
import { c as getFaces } from "./topologyQueryFns-Do8E4EXj.js";
|
|
3
|
+
import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-mo4ThIHz.js";
|
|
4
|
+
import { n as getHashCode } from "./shapeFns-DyBbhU30.js";
|
|
5
|
+
import { n as measureArea } from "./measureFns-Dkh_DmrE.js";
|
|
6
6
|
//#region src/topology/shapeRef/scoring.ts
|
|
7
7
|
/**
|
|
8
8
|
* Default face scorer combining surface type, normal alignment, centroid proximity,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
2
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
-
const require_faceFns = require("./faceFns-
|
|
4
|
-
const require_shapeFns = require("./shapeFns-
|
|
5
|
-
const require_measureFns = require("./measureFns-
|
|
2
|
+
const require_topologyQueryFns = require("./topologyQueryFns-ygBBXxnP.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-DKg2St8b.cjs");
|
|
4
|
+
const require_shapeFns = require("./shapeFns-L4a8kH_A.cjs");
|
|
5
|
+
const require_measureFns = require("./measureFns-Q2dnokUU.cjs");
|
|
6
6
|
//#region src/topology/shapeRef/scoring.ts
|
|
7
7
|
/**
|
|
8
8
|
* Default face scorer combining surface type, normal alignment, centroid proximity,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
1
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-DDZELjlB.cjs");
|
|
2
2
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
3
3
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
4
4
|
//#region src/kernel/quality.ts
|
|
@@ -4477,70 +4477,6 @@ function makeLine2d$1(x1, y1, x2, y2) {
|
|
|
4477
4477
|
function makeCircle2d$1(cx, cy, radius, sense) {
|
|
4478
4478
|
return require_occtWasmAdapter.makeCircle2d(cx, cy, radius, sense);
|
|
4479
4479
|
}
|
|
4480
|
-
function makeArc2dThreePoints$1(x1, y1, xm, ym, x2, y2) {
|
|
4481
|
-
const d = 2 * (x1 * (ym - y2) + xm * (y2 - y1) + x2 * (y1 - ym));
|
|
4482
|
-
if (Math.abs(d) < 1e-12) return require_occtWasmAdapter.makeLine2d(x1, y1, x2, y2);
|
|
4483
|
-
const cx = ((x1 * x1 + y1 * y1) * (ym - y2) + (xm * xm + ym * ym) * (y2 - y1) + (x2 * x2 + y2 * y2) * (y1 - ym)) / d;
|
|
4484
|
-
const cy = ((x1 * x1 + y1 * y1) * (x2 - xm) + (xm * xm + ym * ym) * (x1 - x2) + (x2 * x2 + y2 * y2) * (xm - x1)) / d;
|
|
4485
|
-
const radius = Math.sqrt((x1 - cx) ** 2 + (y1 - cy) ** 2);
|
|
4486
|
-
const a1 = Math.atan2(y1 - cy, x1 - cx);
|
|
4487
|
-
const am = Math.atan2(ym - cy, xm - cx);
|
|
4488
|
-
const a2 = Math.atan2(y2 - cy, x2 - cx);
|
|
4489
|
-
let da1m = am - a1;
|
|
4490
|
-
if (da1m < 0) da1m += 2 * Math.PI;
|
|
4491
|
-
let da12 = a2 - a1;
|
|
4492
|
-
if (da12 < 0) da12 += 2 * Math.PI;
|
|
4493
|
-
const sense = da1m < da12;
|
|
4494
|
-
const circle = require_occtWasmAdapter.makeCircle2d(cx, cy, radius, sense);
|
|
4495
|
-
if (!sense) {
|
|
4496
|
-
const tStart = -a1;
|
|
4497
|
-
let tEnd = -a2;
|
|
4498
|
-
if (tEnd < tStart - 1e-9) tEnd += 2 * Math.PI;
|
|
4499
|
-
return {
|
|
4500
|
-
__bk2d: "trimmed",
|
|
4501
|
-
basis: circle,
|
|
4502
|
-
tStart,
|
|
4503
|
-
tEnd
|
|
4504
|
-
};
|
|
4505
|
-
}
|
|
4506
|
-
let tEnd = a2;
|
|
4507
|
-
if (tEnd < a1 - 1e-9) tEnd += 2 * Math.PI;
|
|
4508
|
-
return {
|
|
4509
|
-
__bk2d: "trimmed",
|
|
4510
|
-
basis: circle,
|
|
4511
|
-
tStart: a1,
|
|
4512
|
-
tEnd
|
|
4513
|
-
};
|
|
4514
|
-
}
|
|
4515
|
-
function makeArc2dTangent$1(sx, sy, tx, ty, ex, ey) {
|
|
4516
|
-
const len = Math.sqrt(tx * tx + ty * ty);
|
|
4517
|
-
const ntx = len > 0 ? tx / len : 0;
|
|
4518
|
-
const nty = len > 0 ? ty / len : 0;
|
|
4519
|
-
const dx = sx - ex;
|
|
4520
|
-
const dy = sy - ey;
|
|
4521
|
-
const denom = 2 * (dy * ntx - dx * nty);
|
|
4522
|
-
if (Math.abs(denom) < 1e-12) return require_occtWasmAdapter.makeLine2d(sx, sy, ex, ey);
|
|
4523
|
-
const t = -(dx * dx + dy * dy) / denom;
|
|
4524
|
-
const cx = sx - t * nty;
|
|
4525
|
-
const cy = sy + t * ntx;
|
|
4526
|
-
const radius = Math.abs(t);
|
|
4527
|
-
const a1 = Math.atan2(sy - cy, sx - cx);
|
|
4528
|
-
const a2 = Math.atan2(ey - cy, ex - cx);
|
|
4529
|
-
const ccwTanX = -(sy - cy) / radius;
|
|
4530
|
-
const ccwTanY = (sx - cx) / radius;
|
|
4531
|
-
const dotCcw = ntx * ccwTanX + nty * ccwTanY;
|
|
4532
|
-
let aMid;
|
|
4533
|
-
if (dotCcw > 0) {
|
|
4534
|
-
let da = a2 - a1;
|
|
4535
|
-
if (da <= 0) da += 2 * Math.PI;
|
|
4536
|
-
aMid = a1 + da / 2;
|
|
4537
|
-
} else {
|
|
4538
|
-
let da = a2 - a1;
|
|
4539
|
-
if (da >= 0) da -= 2 * Math.PI;
|
|
4540
|
-
aMid = a1 + da / 2;
|
|
4541
|
-
}
|
|
4542
|
-
return makeArc2dThreePoints$1(sx, sy, cx + radius * Math.cos(aMid), cy + radius * Math.sin(aMid), ex, ey);
|
|
4543
|
-
}
|
|
4544
4480
|
function makeEllipse2d$1(cx, cy, major, minor, xDirX, xDirY, sense) {
|
|
4545
4481
|
return require_occtWasmAdapter.makeEllipse2d(cx, cy, major, minor, xDirX, xDirY, sense);
|
|
4546
4482
|
}
|
|
@@ -5251,8 +5187,8 @@ function makeKernel2dOps$1(oc) {
|
|
|
5251
5187
|
createAxis2d: (px, py, dx, dy) => createAxis2d$1(px, py, dx, dy),
|
|
5252
5188
|
makeLine2d: (x1, y1, x2, y2) => makeLine2d$1(x1, y1, x2, y2),
|
|
5253
5189
|
makeCircle2d: (cx, cy, radius, sense) => makeCircle2d$1(cx, cy, radius, sense),
|
|
5254
|
-
makeArc2dThreePoints: (x1, y1, xm, ym, x2, y2) => makeArc2dThreePoints
|
|
5255
|
-
makeArc2dTangent: (startX, startY, tangentX, tangentY, endX, endY) => makeArc2dTangent
|
|
5190
|
+
makeArc2dThreePoints: (x1, y1, xm, ym, x2, y2) => require_occtWasmAdapter.makeArc2dThreePoints(x1, y1, xm, ym, x2, y2),
|
|
5191
|
+
makeArc2dTangent: (startX, startY, tangentX, tangentY, endX, endY) => require_occtWasmAdapter.makeArc2dTangent(startX, startY, tangentX, tangentY, endX, endY),
|
|
5256
5192
|
makeEllipse2d: (cx, cy, majorRadius, minorRadius, xDirX, xDirY, sense) => makeEllipse2d$1(cx, cy, majorRadius, minorRadius, xDirX, xDirY, sense),
|
|
5257
5193
|
makeEllipseArc2d: (cx, cy, majorRadius, minorRadius, startAngle, endAngle, xDirX, xDirY, sense) => makeEllipseArc2d$1(cx, cy, majorRadius, minorRadius, startAngle, endAngle, xDirX, xDirY, sense),
|
|
5258
5194
|
makeBezier2d: (points) => makeBezier2d$1(points),
|
|
@@ -8477,70 +8413,6 @@ function makeLine2d(x1, y1, x2, y2) {
|
|
|
8477
8413
|
function makeCircle2d(cx, cy, radius, sense) {
|
|
8478
8414
|
return require_occtWasmAdapter.makeCircle2d(cx, cy, radius, sense);
|
|
8479
8415
|
}
|
|
8480
|
-
function makeArc2dThreePoints(x1, y1, xm, ym, x2, y2) {
|
|
8481
|
-
const d = 2 * (x1 * (ym - y2) + xm * (y2 - y1) + x2 * (y1 - ym));
|
|
8482
|
-
if (Math.abs(d) < 1e-12) return require_occtWasmAdapter.makeLine2d(x1, y1, x2, y2);
|
|
8483
|
-
const cx = ((x1 * x1 + y1 * y1) * (ym - y2) + (xm * xm + ym * ym) * (y2 - y1) + (x2 * x2 + y2 * y2) * (y1 - ym)) / d;
|
|
8484
|
-
const cy = ((x1 * x1 + y1 * y1) * (x2 - xm) + (xm * xm + ym * ym) * (x1 - x2) + (x2 * x2 + y2 * y2) * (xm - x1)) / d;
|
|
8485
|
-
const radius = Math.sqrt((x1 - cx) ** 2 + (y1 - cy) ** 2);
|
|
8486
|
-
const a1 = Math.atan2(y1 - cy, x1 - cx);
|
|
8487
|
-
const am = Math.atan2(ym - cy, xm - cx);
|
|
8488
|
-
const a2 = Math.atan2(y2 - cy, x2 - cx);
|
|
8489
|
-
let da1m = am - a1;
|
|
8490
|
-
if (da1m < 0) da1m += 2 * Math.PI;
|
|
8491
|
-
let da12 = a2 - a1;
|
|
8492
|
-
if (da12 < 0) da12 += 2 * Math.PI;
|
|
8493
|
-
const sense = da1m < da12;
|
|
8494
|
-
const circle = require_occtWasmAdapter.makeCircle2d(cx, cy, radius, sense);
|
|
8495
|
-
if (!sense) {
|
|
8496
|
-
const tStart = -a1;
|
|
8497
|
-
let tEnd = -a2;
|
|
8498
|
-
if (tEnd < tStart - 1e-9) tEnd += 2 * Math.PI;
|
|
8499
|
-
return {
|
|
8500
|
-
__bk2d: "trimmed",
|
|
8501
|
-
basis: circle,
|
|
8502
|
-
tStart,
|
|
8503
|
-
tEnd
|
|
8504
|
-
};
|
|
8505
|
-
}
|
|
8506
|
-
let tEnd = a2;
|
|
8507
|
-
if (tEnd < a1 - 1e-9) tEnd += 2 * Math.PI;
|
|
8508
|
-
return {
|
|
8509
|
-
__bk2d: "trimmed",
|
|
8510
|
-
basis: circle,
|
|
8511
|
-
tStart: a1,
|
|
8512
|
-
tEnd
|
|
8513
|
-
};
|
|
8514
|
-
}
|
|
8515
|
-
function makeArc2dTangent(sx, sy, tx, ty, ex, ey) {
|
|
8516
|
-
const len = Math.sqrt(tx * tx + ty * ty);
|
|
8517
|
-
const ntx = len > 0 ? tx / len : 0;
|
|
8518
|
-
const nty = len > 0 ? ty / len : 0;
|
|
8519
|
-
const dx = sx - ex;
|
|
8520
|
-
const dy = sy - ey;
|
|
8521
|
-
const denom = 2 * (dy * ntx - dx * nty);
|
|
8522
|
-
if (Math.abs(denom) < 1e-12) return require_occtWasmAdapter.makeLine2d(sx, sy, ex, ey);
|
|
8523
|
-
const t = -(dx * dx + dy * dy) / denom;
|
|
8524
|
-
const cx = sx - t * nty;
|
|
8525
|
-
const cy = sy + t * ntx;
|
|
8526
|
-
const radius = Math.abs(t);
|
|
8527
|
-
const a1 = Math.atan2(sy - cy, sx - cx);
|
|
8528
|
-
const a2 = Math.atan2(ey - cy, ex - cx);
|
|
8529
|
-
const ccwTanX = -(sy - cy) / radius;
|
|
8530
|
-
const ccwTanY = (sx - cx) / radius;
|
|
8531
|
-
const dotCcw = ntx * ccwTanX + nty * ccwTanY;
|
|
8532
|
-
let aMid;
|
|
8533
|
-
if (dotCcw > 0) {
|
|
8534
|
-
let da = a2 - a1;
|
|
8535
|
-
if (da <= 0) da += 2 * Math.PI;
|
|
8536
|
-
aMid = a1 + da / 2;
|
|
8537
|
-
} else {
|
|
8538
|
-
let da = a2 - a1;
|
|
8539
|
-
if (da >= 0) da -= 2 * Math.PI;
|
|
8540
|
-
aMid = a1 + da / 2;
|
|
8541
|
-
}
|
|
8542
|
-
return makeArc2dThreePoints(sx, sy, cx + radius * Math.cos(aMid), cy + radius * Math.sin(aMid), ex, ey);
|
|
8543
|
-
}
|
|
8544
8416
|
function makeEllipse2d(cx, cy, major, minor, xDirX, xDirY, sense) {
|
|
8545
8417
|
return require_occtWasmAdapter.makeEllipse2d(cx, cy, major, minor, xDirX, xDirY, sense);
|
|
8546
8418
|
}
|
|
@@ -9337,8 +9209,8 @@ function makeKernel2dOps(bk) {
|
|
|
9337
9209
|
createCurve2dAdaptor: (handle) => createCurve2dAdaptor(handle),
|
|
9338
9210
|
makeLine2d: (x1, y1, x2, y2) => makeLine2d(x1, y1, x2, y2),
|
|
9339
9211
|
makeCircle2d: (cx, cy, radius, sense) => makeCircle2d(cx, cy, radius, sense),
|
|
9340
|
-
makeArc2dThreePoints: (x1, y1, xm, ym, x2, y2) => makeArc2dThreePoints(x1, y1, xm, ym, x2, y2),
|
|
9341
|
-
makeArc2dTangent: (sx, sy, tx, ty, ex, ey) => makeArc2dTangent(sx, sy, tx, ty, ex, ey),
|
|
9212
|
+
makeArc2dThreePoints: (x1, y1, xm, ym, x2, y2) => require_occtWasmAdapter.makeArc2dThreePoints(x1, y1, xm, ym, x2, y2),
|
|
9213
|
+
makeArc2dTangent: (sx, sy, tx, ty, ex, ey) => require_occtWasmAdapter.makeArc2dTangent(sx, sy, tx, ty, ex, ey),
|
|
9342
9214
|
makeEllipse2d: (cx, cy, major, minor, xDirX, xDirY, sense) => makeEllipse2d(cx, cy, major, minor, xDirX, xDirY, sense),
|
|
9343
9215
|
makeEllipseArc2d: (cx, cy, major, minor, start, end, xDirX, xDirY, sense) => makeEllipseArc2d(cx, cy, major, minor, start, end, xDirX, xDirY, sense),
|
|
9344
9216
|
makeBezier2d: (points) => makeBezier2d(points),
|