brepjs 18.78.1 → 18.80.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 +172 -298
- package/dist/brepjs.js +156 -286
- package/dist/index.d.ts +1 -1
- package/dist/kernel/solverAdapter.d.ts +5 -3
- 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
|
@@ -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 };
|