brepjs 18.78.1 → 18.79.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/brepjs.cjs +18 -287
- package/dist/brepjs.js +2 -275
- package/dist/index.d.ts +1 -1
- package/dist/operations/jointFns.d.ts +88 -14
- package/dist/operations.cjs +12 -1
- package/dist/operations.d.ts +1 -0
- package/dist/operations.js +2 -2
- package/dist/{threadFns-a_C2wGGt.cjs → threadFns-B7a1EVpS.cjs} +498 -0
- package/dist/{threadFns-DGEyXFGP.js → threadFns-Cra0yHSF.js} +415 -1
- package/package.json +1 -1
package/dist/brepjs.js
CHANGED
|
@@ -15,7 +15,7 @@ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayA
|
|
|
15
15
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-hTXdNCYm.js";
|
|
16
16
|
import { A as cutAll, C as threePointArc, D as wireLoop, E as wire, F as sectionToFace$1, I as slice$1, L as split$1, M as fuseAll, N as intersect$2, O as booleanPipeline, P as section$1, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as fuse$2, k as cut$2, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-BSKbI4Kl.js";
|
|
17
17
|
import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, R as toLODGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-Bm-NdBj_.js";
|
|
18
|
-
import { C as
|
|
18
|
+
import { A as quatRotate, C as prismaticJoint, D as sphericalJoint, E as setJointValues, F as findNode, H as exportAssemblySTEP, I as removeChild, L as updateNode, M as collectShapes, N as countNodes, O as quatFromAxisAngle, P as createAssemblyNode, R as walkAssembly, S as planarJoint, T as setJointValue, U as createAssembly, V as linearPattern, _ as addJoint, a as deserializeHistory, b as jointTransform, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as addChild, k as quatFromTo, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, r as createHistory, s as getShape, t as thread, u as registerShape, v as cylindricalJoint, w as revoluteJoint, x as mechanismDOF, y as forwardKinematics, z as circularPattern } from "./threadFns-Cra0yHSF.js";
|
|
19
19
|
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-EYqKWQh0.js";
|
|
20
20
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-CD8EMZ5l.js";
|
|
21
21
|
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-D_LwehLr.js";
|
|
@@ -2143,94 +2143,6 @@ function roof(w, options) {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
2145
|
//#endregion
|
|
2146
|
-
//#region src/utils/quaternion.ts
|
|
2147
|
-
function dot$1(a, b) {
|
|
2148
|
-
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
2149
|
-
}
|
|
2150
|
-
function cross$1(a, b) {
|
|
2151
|
-
return [
|
|
2152
|
-
a[1] * b[2] - a[2] * b[1],
|
|
2153
|
-
a[2] * b[0] - a[0] * b[2],
|
|
2154
|
-
a[0] * b[1] - a[1] * b[0]
|
|
2155
|
-
];
|
|
2156
|
-
}
|
|
2157
|
-
function normalize$1(a) {
|
|
2158
|
-
const l = Math.hypot(a[0], a[1], a[2]) || 1;
|
|
2159
|
-
return [
|
|
2160
|
-
a[0] / l,
|
|
2161
|
-
a[1] / l,
|
|
2162
|
-
a[2] / l
|
|
2163
|
-
];
|
|
2164
|
-
}
|
|
2165
|
-
/** A unit vector perpendicular to `v` (for the 180°/parallel degenerate cases). */
|
|
2166
|
-
function anyPerpendicular$1(v) {
|
|
2167
|
-
return normalize$1(cross$1(v, Math.abs(v[0]) < .9 ? [
|
|
2168
|
-
1,
|
|
2169
|
-
0,
|
|
2170
|
-
0
|
|
2171
|
-
] : [
|
|
2172
|
-
0,
|
|
2173
|
-
1,
|
|
2174
|
-
0
|
|
2175
|
-
]));
|
|
2176
|
-
}
|
|
2177
|
-
/** Rotate vector `v` by quaternion `q`. */
|
|
2178
|
-
function quatRotate(q, v) {
|
|
2179
|
-
const [w, x, y, z] = q;
|
|
2180
|
-
const tx = 2 * (y * v[2] - z * v[1]);
|
|
2181
|
-
const ty = 2 * (z * v[0] - x * v[2]);
|
|
2182
|
-
const tz = 2 * (x * v[1] - y * v[0]);
|
|
2183
|
-
return [
|
|
2184
|
-
v[0] + w * tx + (y * tz - z * ty),
|
|
2185
|
-
v[1] + w * ty + (z * tx - x * tz),
|
|
2186
|
-
v[2] + w * tz + (x * ty - y * tx)
|
|
2187
|
-
];
|
|
2188
|
-
}
|
|
2189
|
-
/** Quaternion for a rotation of `angle` radians about (unit-normalized) `axis`. */
|
|
2190
|
-
function quatFromAxisAngle(axis, angle) {
|
|
2191
|
-
const h = angle / 2;
|
|
2192
|
-
const s = Math.sin(h);
|
|
2193
|
-
const u = normalize$1(axis);
|
|
2194
|
-
return [
|
|
2195
|
-
Math.cos(h),
|
|
2196
|
-
u[0] * s,
|
|
2197
|
-
u[1] * s,
|
|
2198
|
-
u[2] * s
|
|
2199
|
-
];
|
|
2200
|
-
}
|
|
2201
|
-
/** Shortest-arc quaternion rotating unit vector `from` onto unit vector `to`. */
|
|
2202
|
-
function quatFromTo(from, to) {
|
|
2203
|
-
const a = normalize$1(from);
|
|
2204
|
-
const b = normalize$1(to);
|
|
2205
|
-
const d = dot$1(a, b);
|
|
2206
|
-
if (d >= .999999999) return [
|
|
2207
|
-
1,
|
|
2208
|
-
0,
|
|
2209
|
-
0,
|
|
2210
|
-
0
|
|
2211
|
-
];
|
|
2212
|
-
if (d <= -.999999999) return quatFromAxisAngle(anyPerpendicular$1(a), Math.PI);
|
|
2213
|
-
const c = cross$1(a, b);
|
|
2214
|
-
const len = Math.hypot(1 + d, c[0], c[1], c[2]) || 1;
|
|
2215
|
-
return [
|
|
2216
|
-
(1 + d) / len,
|
|
2217
|
-
c[0] / len,
|
|
2218
|
-
c[1] / len,
|
|
2219
|
-
c[2] / len
|
|
2220
|
-
];
|
|
2221
|
-
}
|
|
2222
|
-
/** Hamilton product `a ⊗ b` — the rotation that applies `b` first, then `a`. */
|
|
2223
|
-
function quatMultiply(a, b) {
|
|
2224
|
-
const [aw, ax, ay, az] = a;
|
|
2225
|
-
const [bw, bx, by, bz] = b;
|
|
2226
|
-
return [
|
|
2227
|
-
aw * bw - ax * bx - ay * by - az * bz,
|
|
2228
|
-
aw * bx + ax * bw + ay * bz - az * by,
|
|
2229
|
-
aw * by - ax * bz + ay * bw + az * bx,
|
|
2230
|
-
aw * bz + ax * by - ay * bx + az * bw
|
|
2231
|
-
];
|
|
2232
|
-
}
|
|
2233
|
-
//#endregion
|
|
2234
2146
|
//#region src/kernel/solverAdapter.ts
|
|
2235
2147
|
/**
|
|
2236
2148
|
* Constraint solver adapter — analytical solver for simple assembly mates.
|
|
@@ -2630,191 +2542,6 @@ function solveAssembly(assembly) {
|
|
|
2630
2542
|
}
|
|
2631
2543
|
}
|
|
2632
2544
|
//#endregion
|
|
2633
|
-
//#region src/operations/jointFns.ts
|
|
2634
|
-
var DEG2RAD$1 = Math.PI / 180;
|
|
2635
|
-
function clamp(value, min, max) {
|
|
2636
|
-
return Math.min(max, Math.max(min, value));
|
|
2637
|
-
}
|
|
2638
|
-
function unit(v) {
|
|
2639
|
-
const l = Math.hypot(v[0], v[1], v[2]) || 1;
|
|
2640
|
-
return [
|
|
2641
|
-
v[0] / l,
|
|
2642
|
-
v[1] / l,
|
|
2643
|
-
v[2] / l
|
|
2644
|
-
];
|
|
2645
|
-
}
|
|
2646
|
-
function makeJoint(type, parent, child, axis, opts, defMin, defMax) {
|
|
2647
|
-
const a = opts.min ?? defMin;
|
|
2648
|
-
const b = opts.max ?? defMax;
|
|
2649
|
-
const min = Math.min(a, b);
|
|
2650
|
-
const max = Math.max(a, b);
|
|
2651
|
-
return {
|
|
2652
|
-
type,
|
|
2653
|
-
parent,
|
|
2654
|
-
child,
|
|
2655
|
-
axis: {
|
|
2656
|
-
origin: axis.origin,
|
|
2657
|
-
direction: unit(axis.direction)
|
|
2658
|
-
},
|
|
2659
|
-
min,
|
|
2660
|
-
max,
|
|
2661
|
-
value: clamp(opts.value ?? 0, min, max)
|
|
2662
|
-
};
|
|
2663
|
-
}
|
|
2664
|
-
/** A revolute (hinge) joint — the child rotates about `axis` by `value` degrees. */
|
|
2665
|
-
function revoluteJoint(parent, child, axis, opts = {}) {
|
|
2666
|
-
return makeJoint("revolute", parent, child, axis, opts, -180, 180);
|
|
2667
|
-
}
|
|
2668
|
-
/**
|
|
2669
|
-
* A prismatic (slider) joint — the child translates along `axis` by `value`
|
|
2670
|
-
* units. Only `axis.direction` is used; `axis.origin` is ignored (a pure
|
|
2671
|
-
* translation has no anchor point), unlike a revolute joint which rotates about
|
|
2672
|
-
* the axis line through `origin`.
|
|
2673
|
-
*/
|
|
2674
|
-
function prismaticJoint(parent, child, axis, opts = {}) {
|
|
2675
|
-
return makeJoint("prismatic", parent, child, axis, opts, 0, 100);
|
|
2676
|
-
}
|
|
2677
|
-
/** Return a copy of `joint` with its drivable parameter set (clamped to range). */
|
|
2678
|
-
function setJointValue(joint, value) {
|
|
2679
|
-
return {
|
|
2680
|
-
...joint,
|
|
2681
|
-
value: clamp(value, joint.min, joint.max)
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
/**
|
|
2685
|
-
* The child's local rigid transform (relative to the parent) for a joint value.
|
|
2686
|
-
* Defaults to the joint's stored value; an explicit value is clamped to range.
|
|
2687
|
-
*
|
|
2688
|
-
* - **revolute**: rotation of `value` degrees about the axis line. Rotating
|
|
2689
|
-
* about a line through `origin` is `p ↦ R·p + (origin − R·origin)`.
|
|
2690
|
-
* - **prismatic**: translation of `value` units along the axis direction.
|
|
2691
|
-
*/
|
|
2692
|
-
function jointTransform(joint, value = joint.value) {
|
|
2693
|
-
const v = clamp(value, joint.min, joint.max);
|
|
2694
|
-
const dir = unit(joint.axis.direction);
|
|
2695
|
-
if (joint.type === "prismatic") return {
|
|
2696
|
-
position: [
|
|
2697
|
-
dir[0] * v,
|
|
2698
|
-
dir[1] * v,
|
|
2699
|
-
dir[2] * v
|
|
2700
|
-
],
|
|
2701
|
-
rotation: [
|
|
2702
|
-
1,
|
|
2703
|
-
0,
|
|
2704
|
-
0,
|
|
2705
|
-
0
|
|
2706
|
-
]
|
|
2707
|
-
};
|
|
2708
|
-
const rotation = quatFromAxisAngle(dir, v * DEG2RAD$1);
|
|
2709
|
-
const o = joint.axis.origin;
|
|
2710
|
-
const ro = quatRotate(rotation, o);
|
|
2711
|
-
return {
|
|
2712
|
-
position: [
|
|
2713
|
-
o[0] - ro[0],
|
|
2714
|
-
o[1] - ro[1],
|
|
2715
|
-
o[2] - ro[2]
|
|
2716
|
-
],
|
|
2717
|
-
rotation
|
|
2718
|
-
};
|
|
2719
|
-
}
|
|
2720
|
-
/** Attach a joint to an assembly node. Returns a new node (immutable). */
|
|
2721
|
-
function addJoint(assembly, joint) {
|
|
2722
|
-
const existing = assembly.joints ?? [];
|
|
2723
|
-
return {
|
|
2724
|
-
...assembly,
|
|
2725
|
-
joints: [...existing, joint]
|
|
2726
|
-
};
|
|
2727
|
-
}
|
|
2728
|
-
var IDENTITY_POSE = {
|
|
2729
|
-
position: [
|
|
2730
|
-
0,
|
|
2731
|
-
0,
|
|
2732
|
-
0
|
|
2733
|
-
],
|
|
2734
|
-
rotation: [
|
|
2735
|
-
1,
|
|
2736
|
-
0,
|
|
2737
|
-
0,
|
|
2738
|
-
0
|
|
2739
|
-
]
|
|
2740
|
-
};
|
|
2741
|
-
/** Compose two poses: the result applies `b` in `a`'s frame (`a ∘ b`). */
|
|
2742
|
-
function composePose(a, b) {
|
|
2743
|
-
const rb = quatRotate(a.rotation, b.position);
|
|
2744
|
-
return {
|
|
2745
|
-
position: [
|
|
2746
|
-
a.position[0] + rb[0],
|
|
2747
|
-
a.position[1] + rb[1],
|
|
2748
|
-
a.position[2] + rb[2]
|
|
2749
|
-
],
|
|
2750
|
-
rotation: quatMultiply(a.rotation, b.rotation)
|
|
2751
|
-
};
|
|
2752
|
-
}
|
|
2753
|
-
/** Collect every joint attached anywhere in the assembly tree. */
|
|
2754
|
-
function collectJoints(assembly) {
|
|
2755
|
-
const joints = [];
|
|
2756
|
-
walkAssembly(assembly, (node) => {
|
|
2757
|
-
if (node.joints) joints.push(...node.joints);
|
|
2758
|
-
});
|
|
2759
|
-
return joints;
|
|
2760
|
-
}
|
|
2761
|
-
/**
|
|
2762
|
-
* Forward kinematics: set joint values and propagate world poses down the
|
|
2763
|
-
* kinematic chain. Each joint's axis is interpreted in its **parent's** frame,
|
|
2764
|
-
* so a child's world pose is `parentWorld ∘ jointTransform(joint, value)`.
|
|
2765
|
-
*
|
|
2766
|
-
* Bodies not driven by a joint (chain roots) start at the origin. `jointValues`
|
|
2767
|
-
* overrides a joint's stored value, keyed by the **child** node name; omitted
|
|
2768
|
-
* joints use `joint.value`. Resolution is topological (reuses the Phase-0
|
|
2769
|
-
* ordering), so chains of any depth compose. Returns a world pose for every node.
|
|
2770
|
-
*/
|
|
2771
|
-
function forwardKinematics(assembly, jointValues = {}) {
|
|
2772
|
-
const joints = [];
|
|
2773
|
-
const names = /* @__PURE__ */ new Set();
|
|
2774
|
-
walkAssembly(assembly, (node) => {
|
|
2775
|
-
names.add(node.name);
|
|
2776
|
-
if (node.joints) joints.push(...node.joints);
|
|
2777
|
-
});
|
|
2778
|
-
const byChild = /* @__PURE__ */ new Map();
|
|
2779
|
-
for (const j of joints) {
|
|
2780
|
-
byChild.set(j.child, j);
|
|
2781
|
-
names.add(j.parent);
|
|
2782
|
-
names.add(j.child);
|
|
2783
|
-
}
|
|
2784
|
-
const poses = /* @__PURE__ */ new Map();
|
|
2785
|
-
for (const name of names) if (!byChild.has(name)) poses.set(name, IDENTITY_POSE);
|
|
2786
|
-
const pending = [...joints];
|
|
2787
|
-
let progress = true;
|
|
2788
|
-
while (progress && pending.length > 0) {
|
|
2789
|
-
progress = false;
|
|
2790
|
-
for (let i = pending.length - 1; i >= 0; i--) {
|
|
2791
|
-
const j = pending[i];
|
|
2792
|
-
if (!j) continue;
|
|
2793
|
-
const parentPose = poses.get(j.parent);
|
|
2794
|
-
if (!parentPose) continue;
|
|
2795
|
-
pending.splice(i, 1);
|
|
2796
|
-
progress = true;
|
|
2797
|
-
if (poses.has(j.child)) continue;
|
|
2798
|
-
const value = jointValues[j.child] ?? j.value;
|
|
2799
|
-
poses.set(j.child, composePose(parentPose, jointTransform(j, value)));
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
|
-
for (const j of pending) if (!poses.has(j.child)) poses.set(j.child, IDENTITY_POSE);
|
|
2803
|
-
return poses;
|
|
2804
|
-
}
|
|
2805
|
-
var JOINT_FREEDOM = {
|
|
2806
|
-
revolute: 1,
|
|
2807
|
-
prismatic: 1
|
|
2808
|
-
};
|
|
2809
|
-
/**
|
|
2810
|
-
* Open-chain mobility — the number of independent degrees of freedom. Each
|
|
2811
|
-
* revolute/prismatic joint contributes 1, so for a serial chain this equals the
|
|
2812
|
-
* joint count. (Closed-loop Grübler/Kutzbach analysis is future work.)
|
|
2813
|
-
*/
|
|
2814
|
-
function mechanismDOF(assembly) {
|
|
2815
|
-
return collectJoints(assembly).reduce((sum, j) => sum + JOINT_FREEDOM[j.type], 0);
|
|
2816
|
-
}
|
|
2817
|
-
//#endregion
|
|
2818
2545
|
//#region src/measurement/interferenceFns.ts
|
|
2819
2546
|
/**
|
|
2820
2547
|
* Interference detection between shapes.
|
|
@@ -6584,4 +6311,4 @@ var csg_exports = /* @__PURE__ */ __exportAll({
|
|
|
6584
6311
|
withEvaluator: () => withEvaluator
|
|
6585
6312
|
});
|
|
6586
6313
|
//#endregion
|
|
6587
|
-
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, init, initFromManifold, initFromOC, initVoxel, innerWires, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, ioNs_exports as io, ioError, is2D, is3D, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTransform, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
6314
|
+
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, init, initFromManifold, initFromOC, initVoxel, innerWires, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, ioNs_exports as io, ioError, is2D, is3D, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTransform, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
package/dist/index.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export { exportAssemblySTEP, type ShapeOptions, type SupportedUnit, } from './op
|
|
|
121
121
|
export { linearPattern, circularPattern } from './operations/patternFns.js';
|
|
122
122
|
export { createAssemblyNode, addChild, removeChild, updateNode, findNode, walkAssembly, countNodes, collectShapes, type AssemblyNode, type AssemblyNodeOptions, } from './operations/assemblyFns.js';
|
|
123
123
|
export { addMate, solveAssembly, type MateConstraint, type MateEntity, type AssemblySolveResult, } from './operations/mateFns.js';
|
|
124
|
-
export { revoluteJoint, prismaticJoint, setJointValue, jointTransform, addJoint, forwardKinematics, mechanismDOF, type Joint, type JointAxis, type JointType, type JointPose, type JointOptions, } from './operations/jointFns.js';
|
|
124
|
+
export { revoluteJoint, prismaticJoint, cylindricalJoint, planarJoint, sphericalJoint, setJointValue, setJointValues, jointTransform, addJoint, forwardKinematics, mechanismDOF, type Joint, type JointDOF, type JointAxis, type JointType, type JointPose, type JointOptions, type CylindricalOptions, type PlanarOptions, type SphericalOptions, } from './operations/jointFns.js';
|
|
125
125
|
export { createHistory, addStep, undoLast, findStep, getShape as getHistoryShape, stepCount, stepsFrom, registerShape, createRegistry, registerOperation, replayHistory, replayFrom, modifyStep, serializeHistory, deserializeHistory, type OperationStep, type ModelHistory, type SerializedHistory, type OperationFn, type OperationRegistry as HistoryOperationRegistry, } from './operations/historyFns.js';
|
|
126
126
|
export { measureVolume, measureArea, measureLength, measureDistance, measureDistanceProps, createDistanceQuery, measureVolumeProps, measureSurfaceProps, measureLinearProps, type PhysicalProps, type VolumeProps, type SurfaceProps, type LinearProps, type DistanceProps, measureCurvatureAt, measureCurvatureAtMid, type CurvatureResult, } from './measurement/measureFns.js';
|
|
127
127
|
export { checkInterference, checkAllInterferences, type InterferenceResult, type InterferencePair, } from './measurement/interferenceFns.js';
|
|
@@ -5,18 +5,33 @@ export interface JointAxis {
|
|
|
5
5
|
readonly origin: Vec3;
|
|
6
6
|
readonly direction: Vec3;
|
|
7
7
|
}
|
|
8
|
-
export type JointType = 'revolute' | 'prismatic';
|
|
8
|
+
export type JointType = 'revolute' | 'prismatic' | 'cylindrical' | 'planar' | 'spherical';
|
|
9
|
+
/**
|
|
10
|
+
* A single drivable degree of freedom. A `rotation` DOF turns about the joint's
|
|
11
|
+
* anchor point along `axis` (degrees); a `translation` DOF slides along `axis`
|
|
12
|
+
* (length units). `value` is always clamped to `[min, max]`.
|
|
13
|
+
*/
|
|
14
|
+
export interface JointDOF {
|
|
15
|
+
readonly kind: 'rotation' | 'translation';
|
|
16
|
+
readonly axis: Vec3;
|
|
17
|
+
readonly min: number;
|
|
18
|
+
readonly max: number;
|
|
19
|
+
readonly value: number;
|
|
20
|
+
}
|
|
9
21
|
export interface Joint {
|
|
10
22
|
readonly type: JointType;
|
|
11
23
|
/** Reference body (stays put); the child moves relative to it. */
|
|
12
24
|
readonly parent: string;
|
|
13
25
|
readonly child: string;
|
|
26
|
+
/** Primary axis; `origin` is the anchor every rotation DOF pivots about. */
|
|
14
27
|
readonly axis: JointAxis;
|
|
15
|
-
/**
|
|
28
|
+
/** Primary-DOF range bounds (mirror of `dofs[0]`). */
|
|
16
29
|
readonly min: number;
|
|
17
30
|
readonly max: number;
|
|
18
|
-
/**
|
|
31
|
+
/** Primary-DOF value (mirror of `dofs[0]`), always clamped to `[min, max]`. */
|
|
19
32
|
readonly value: number;
|
|
33
|
+
/** All drivable degrees of freedom, in composition order. */
|
|
34
|
+
readonly dofs: readonly JointDOF[];
|
|
20
35
|
}
|
|
21
36
|
/** A rigid transform: translation + quaternion rotation `[w, x, y, z]`. */
|
|
22
37
|
export interface JointPose {
|
|
@@ -31,6 +46,36 @@ export interface JointOptions {
|
|
|
31
46
|
/** Initial value, clamped to the range. Default: 0. */
|
|
32
47
|
value?: number;
|
|
33
48
|
}
|
|
49
|
+
/** Per-DOF ranges for a cylindrical joint (rotation about + slide along one axis). */
|
|
50
|
+
export interface CylindricalOptions {
|
|
51
|
+
/** Rotation DOF (degrees). Default range -180..180. */
|
|
52
|
+
rotation?: JointOptions;
|
|
53
|
+
/** Translation DOF (length). Default range 0..100. */
|
|
54
|
+
translation?: JointOptions;
|
|
55
|
+
}
|
|
56
|
+
/** Per-DOF ranges for a planar joint (two in-plane translations + a rotation). */
|
|
57
|
+
export interface PlanarOptions {
|
|
58
|
+
/** Translation along the in-plane `uDirection`. Default range -100..100. */
|
|
59
|
+
u?: JointOptions;
|
|
60
|
+
/** Translation along `normal × u`. Default range -100..100. */
|
|
61
|
+
v?: JointOptions;
|
|
62
|
+
/** Rotation about the plane normal (degrees). Default range -180..180. */
|
|
63
|
+
rotation?: JointOptions;
|
|
64
|
+
/**
|
|
65
|
+
* In-plane reference direction for the `u` translation. Projected onto the
|
|
66
|
+
* plane and normalized; defaults to an arbitrary perpendicular of the normal.
|
|
67
|
+
*/
|
|
68
|
+
uDirection?: Vec3;
|
|
69
|
+
}
|
|
70
|
+
/** Per-DOF ranges for a spherical joint (three rotations about a pivot). */
|
|
71
|
+
export interface SphericalOptions {
|
|
72
|
+
/** Rotation about local X through the pivot (degrees). Default range -180..180. */
|
|
73
|
+
x?: JointOptions;
|
|
74
|
+
/** Rotation about local Y through the pivot (degrees). Default range -180..180. */
|
|
75
|
+
y?: JointOptions;
|
|
76
|
+
/** Rotation about local Z through the pivot (degrees). Default range -180..180. */
|
|
77
|
+
z?: JointOptions;
|
|
78
|
+
}
|
|
34
79
|
/** A revolute (hinge) joint — the child rotates about `axis` by `value` degrees. */
|
|
35
80
|
export declare function revoluteJoint(parent: string, child: string, axis: JointAxis, opts?: JointOptions): Joint;
|
|
36
81
|
/**
|
|
@@ -40,17 +85,45 @@ export declare function revoluteJoint(parent: string, child: string, axis: Joint
|
|
|
40
85
|
* the axis line through `origin`.
|
|
41
86
|
*/
|
|
42
87
|
export declare function prismaticJoint(parent: string, child: string, axis: JointAxis, opts?: JointOptions): Joint;
|
|
43
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* A cylindrical joint — the child both rotates about and slides along a single
|
|
90
|
+
* `axis` (2 DOF). DOF order: `[rotation, translation]`. The two motions share
|
|
91
|
+
* the axis, so they commute; rotation pivots about `axis.origin`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function cylindricalJoint(parent: string, child: string, axis: JointAxis, opts?: CylindricalOptions): Joint;
|
|
94
|
+
/**
|
|
95
|
+
* A planar joint — the child translates within a plane and rotates about its
|
|
96
|
+
* normal (3 DOF). `plane.direction` is the normal; `plane.origin` the rotation
|
|
97
|
+
* anchor. DOF order: `[u-translation, v-translation, rotation]`, where the
|
|
98
|
+
* translations are applied in the plane frame (independent of the rotation).
|
|
99
|
+
*/
|
|
100
|
+
export declare function planarJoint(parent: string, child: string, plane: JointAxis, opts?: PlanarOptions): Joint;
|
|
101
|
+
/**
|
|
102
|
+
* A spherical (ball) joint — the child rotates freely about a pivot point
|
|
103
|
+
* (3 DOF). DOF order: `[x, y, z]` rotations about the local axes through
|
|
104
|
+
* `pivot`, composed as `Rx · Ry · Rz`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function sphericalJoint(parent: string, child: string, pivot: Vec3, opts?: SphericalOptions): Joint;
|
|
107
|
+
/**
|
|
108
|
+
* Return a copy of `joint` with per-DOF values set (each clamped to its range).
|
|
109
|
+
* Values are positional, matching `joint.dofs`; omitted entries keep their
|
|
110
|
+
* stored value. The primary mirror (`value`) is kept in sync with `dofs[0]`.
|
|
111
|
+
*/
|
|
112
|
+
export declare function setJointValues(joint: Joint, values: readonly number[]): Joint;
|
|
113
|
+
/** Return a copy of `joint` with its primary DOF set (clamped to range). */
|
|
44
114
|
export declare function setJointValue(joint: Joint, value: number): Joint;
|
|
45
115
|
/**
|
|
46
|
-
* The child's local rigid transform (relative to the parent) for
|
|
47
|
-
* Defaults to
|
|
116
|
+
* The child's local rigid transform (relative to the parent) for given DOF
|
|
117
|
+
* values. Defaults to each DOF's stored value. A single `number` overrides only
|
|
118
|
+
* the primary DOF (single-DOF ergonomics); an array overrides positionally,
|
|
119
|
+
* with omitted entries keeping their stored value. Each value is clamped to its
|
|
120
|
+
* DOF range.
|
|
48
121
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
122
|
+
* DOFs are folded in array order via frame composition. For same-anchor
|
|
123
|
+
* rotations (e.g. spherical) this composes to a single rotation about the pivot;
|
|
124
|
+
* for a cylindrical axis the rotation and slide commute.
|
|
52
125
|
*/
|
|
53
|
-
export declare function jointTransform(joint: Joint, value?: number): JointPose;
|
|
126
|
+
export declare function jointTransform(joint: Joint, value?: number | readonly number[]): JointPose;
|
|
54
127
|
/** Attach a joint to an assembly node. Returns a new node (immutable). */
|
|
55
128
|
export declare function addJoint(assembly: AssemblyNode, joint: Joint): AssemblyNode;
|
|
56
129
|
/**
|
|
@@ -63,10 +136,11 @@ export declare function addJoint(assembly: AssemblyNode, joint: Joint): Assembly
|
|
|
63
136
|
* joints use `joint.value`. Resolution is topological (reuses the Phase-0
|
|
64
137
|
* ordering), so chains of any depth compose. Returns a world pose for every node.
|
|
65
138
|
*/
|
|
66
|
-
export declare function forwardKinematics(assembly: AssemblyNode, jointValues?: Readonly<Record<string, number>>): Map<string, JointPose>;
|
|
139
|
+
export declare function forwardKinematics(assembly: AssemblyNode, jointValues?: Readonly<Record<string, number | readonly number[]>>): Map<string, JointPose>;
|
|
67
140
|
/**
|
|
68
|
-
* Open-chain mobility — the number of independent degrees of freedom
|
|
69
|
-
* revolute/prismatic
|
|
70
|
-
*
|
|
141
|
+
* Open-chain mobility — the number of independent degrees of freedom, summing
|
|
142
|
+
* each joint's DOF count (revolute/prismatic 1, cylindrical 2, planar/spherical
|
|
143
|
+
* 3). For a serial chain this equals the total DOF. (Closed-loop
|
|
144
|
+
* Grübler/Kutzbach analysis is future work.)
|
|
71
145
|
*/
|
|
72
146
|
export declare function mechanismDOF(assembly: AssemblyNode): number;
|
package/dist/operations.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_threadFns = require("./threadFns-
|
|
2
|
+
const require_threadFns = require("./threadFns-B7a1EVpS.cjs");
|
|
3
3
|
const require_loftFns = require("./loftFns-DiSsI2PM.cjs");
|
|
4
4
|
exports.addChild = require_threadFns.addChild;
|
|
5
|
+
exports.addJoint = require_threadFns.addJoint;
|
|
5
6
|
exports.addStep = require_threadFns.addStep;
|
|
6
7
|
exports.circularPattern = require_threadFns.circularPattern;
|
|
7
8
|
exports.collectShapes = require_threadFns.collectShapes;
|
|
@@ -11,18 +12,28 @@ exports.createAssembly = require_threadFns.createAssembly;
|
|
|
11
12
|
exports.createAssemblyNode = require_threadFns.createAssemblyNode;
|
|
12
13
|
exports.createHistory = require_threadFns.createHistory;
|
|
13
14
|
exports.createRegistry = require_threadFns.createRegistry;
|
|
15
|
+
exports.cylindricalJoint = require_threadFns.cylindricalJoint;
|
|
14
16
|
exports.exportAssemblySTEP = require_threadFns.exportAssemblySTEP;
|
|
15
17
|
exports.findNode = require_threadFns.findNode;
|
|
16
18
|
exports.findStep = require_threadFns.findStep;
|
|
19
|
+
exports.forwardKinematics = require_threadFns.forwardKinematics;
|
|
17
20
|
exports.getHistoryShape = require_threadFns.getShape;
|
|
18
21
|
exports.gridPattern = require_threadFns.gridPattern;
|
|
22
|
+
exports.jointTransform = require_threadFns.jointTransform;
|
|
19
23
|
exports.linearPattern = require_threadFns.linearPattern;
|
|
24
|
+
exports.mechanismDOF = require_threadFns.mechanismDOF;
|
|
20
25
|
exports.modifyStep = require_threadFns.modifyStep;
|
|
26
|
+
exports.planarJoint = require_threadFns.planarJoint;
|
|
27
|
+
exports.prismaticJoint = require_threadFns.prismaticJoint;
|
|
21
28
|
exports.registerOperation = require_threadFns.registerOperation;
|
|
22
29
|
exports.registerShape = require_threadFns.registerShape;
|
|
23
30
|
exports.removeChild = require_threadFns.removeChild;
|
|
24
31
|
exports.replayFrom = require_threadFns.replayFrom;
|
|
25
32
|
exports.replayHistory = require_threadFns.replayHistory;
|
|
33
|
+
exports.revoluteJoint = require_threadFns.revoluteJoint;
|
|
34
|
+
exports.setJointValue = require_threadFns.setJointValue;
|
|
35
|
+
exports.setJointValues = require_threadFns.setJointValues;
|
|
36
|
+
exports.sphericalJoint = require_threadFns.sphericalJoint;
|
|
26
37
|
exports.stepCount = require_threadFns.stepCount;
|
|
27
38
|
exports.stepsFrom = require_threadFns.stepsFrom;
|
|
28
39
|
exports.supportExtrude = require_loftFns.supportExtrude;
|
package/dist/operations.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { sweep, supportExtrude, complexExtrude, twistExtrude, type SweepOptions,
|
|
|
10
10
|
export { thread, type ThreadOptions } from './operations/threadFns.js';
|
|
11
11
|
export { linearPattern, circularPattern, gridPattern } from './operations/patternFns.js';
|
|
12
12
|
export { createAssemblyNode, addChild, removeChild, updateNode, findNode, walkAssembly, countNodes, collectShapes, type AssemblyNode, type AssemblyNodeOptions, } from './operations/assemblyFns.js';
|
|
13
|
+
export { revoluteJoint, prismaticJoint, cylindricalJoint, planarJoint, sphericalJoint, setJointValue, setJointValues, jointTransform, addJoint, forwardKinematics, mechanismDOF, type Joint, type JointDOF, type JointAxis, type JointType, type JointPose, type JointOptions, type CylindricalOptions, type PlanarOptions, type SphericalOptions, } from './operations/jointFns.js';
|
|
13
14
|
export { exportAssemblySTEP, type ShapeOptions, type SupportedUnit, } from './operations/exporterFns.js';
|
|
14
15
|
export { createHistory, addStep, undoLast, findStep, getShape as getHistoryShape, stepCount, stepsFrom, registerShape, createRegistry, registerOperation, replayHistory, replayFrom, modifyStep, type OperationStep, type ModelHistory, type OperationFn, type OperationRegistry as HistoryOperationRegistry, } from './operations/historyFns.js';
|
|
15
16
|
export { type AssemblyExporter, createAssembly } from './operations/exporters.js';
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { B as gridPattern, C as prismaticJoint, D as sphericalJoint, E as setJointValues, F as findNode, H as exportAssemblySTEP, I as removeChild, L as updateNode, M as collectShapes, N as countNodes, P as createAssemblyNode, R as walkAssembly, S as planarJoint, T as setJointValue, U as createAssembly, V as linearPattern, _ as addJoint, b as jointTransform, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as addChild, l as registerOperation, m as stepCount, n as addStep, o as findStep, r as createHistory, s as getShape, t as thread, u as registerShape, v as cylindricalJoint, w as revoluteJoint, x as mechanismDOF, y as forwardKinematics, z as circularPattern } from "./threadFns-Cra0yHSF.js";
|
|
2
2
|
import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-CsHOwded.js";
|
|
3
|
-
export { addChild, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, exportAssemblySTEP, findNode, findStep, getShape as getHistoryShape, gridPattern, linearPattern, modifyStep, registerOperation, registerShape, removeChild, replayFrom, replayHistory, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
3
|
+
export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, jointTransform, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
|