brepjs 18.81.0 → 18.81.1
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 +6 -3
- package/dist/brepjs.js +6 -3
- package/dist/operations/jointFns.d.ts +6 -1
- package/dist/operations.cjs +1 -1
- package/dist/operations.js +1 -1
- package/dist/{threadFns-ubwexS-v.cjs → threadFns-By0Gy2f9.cjs} +17 -10
- package/dist/{threadFns-D_CxgFXg.js → threadFns-YzJhd0Kz.js} +17 -10
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -17,7 +17,7 @@ const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
|
17
17
|
const require_surfaceBuilders = require("./surfaceBuilders-B8aVZamB.cjs");
|
|
18
18
|
const require_primitiveFns = require("./primitiveFns-DEBQdEkG.cjs");
|
|
19
19
|
const require_healingFns = require("./healingFns--PtL9j2K.cjs");
|
|
20
|
-
const require_threadFns = require("./threadFns-
|
|
20
|
+
const require_threadFns = require("./threadFns-By0Gy2f9.cjs");
|
|
21
21
|
const require_blueprintSketcher = require("./blueprintSketcher-BJPBKhF3.cjs");
|
|
22
22
|
const require_helpers = require("./helpers-B8mE35Fm.cjs");
|
|
23
23
|
const require_drawFns = require("./drawFns-DTpCthM5.cjs");
|
|
@@ -2444,8 +2444,11 @@ function solveMate(c, ref, dep) {
|
|
|
2444
2444
|
switch (c.type) {
|
|
2445
2445
|
case "concentric": return solveConcentric(ref, dep);
|
|
2446
2446
|
case "angle": return solveAngle(ref, dep, (c.value ?? 0) * Math.PI / 180);
|
|
2447
|
-
|
|
2448
|
-
|
|
2447
|
+
default: {
|
|
2448
|
+
const pose = solveTranslational(ref, dep, c.type === "distance" ? c.value ?? 0 : 0);
|
|
2449
|
+
if (!pose) throw new Error(`solveMate: unsupported entity pair escaped filter: ${ref.type}-${dep.type}`);
|
|
2450
|
+
return pose;
|
|
2451
|
+
}
|
|
2449
2452
|
}
|
|
2450
2453
|
}
|
|
2451
2454
|
/**
|
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 { A as quatFromAxisAngle, B as walkAssembly, C as mechanismDOF, D as setJointValue, E as revoluteJoint, F as countNodes, G as createAssembly, I as createAssemblyNode, L as findNode, M as quatRotate, N as addChild, O as setJointValues, P as collectShapes, R as removeChild, S as jointTransform, T as prismaticJoint, U as linearPattern, V as circularPattern, W as exportAssemblySTEP, _ as inverseKinematics, a as deserializeHistory, b as cylindricalJoint, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as quatFromTo, k as sphericalJoint, 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 jointTrajectory, w as planarJoint, x as forwardKinematics, y as addJoint, z as updateNode } from "./threadFns-
|
|
18
|
+
import { A as quatFromAxisAngle, B as walkAssembly, C as mechanismDOF, D as setJointValue, E as revoluteJoint, F as countNodes, G as createAssembly, I as createAssemblyNode, L as findNode, M as quatRotate, N as addChild, O as setJointValues, P as collectShapes, R as removeChild, S as jointTransform, T as prismaticJoint, U as linearPattern, V as circularPattern, W as exportAssemblySTEP, _ as inverseKinematics, a as deserializeHistory, b as cylindricalJoint, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as quatFromTo, k as sphericalJoint, 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 jointTrajectory, w as planarJoint, x as forwardKinematics, y as addJoint, z as updateNode } from "./threadFns-YzJhd0Kz.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";
|
|
@@ -2455,8 +2455,11 @@ function solveMate(c, ref, dep) {
|
|
|
2455
2455
|
switch (c.type) {
|
|
2456
2456
|
case "concentric": return solveConcentric(ref, dep);
|
|
2457
2457
|
case "angle": return solveAngle(ref, dep, (c.value ?? 0) * Math.PI / 180);
|
|
2458
|
-
|
|
2459
|
-
|
|
2458
|
+
default: {
|
|
2459
|
+
const pose = solveTranslational(ref, dep, c.type === "distance" ? c.value ?? 0 : 0);
|
|
2460
|
+
if (!pose) throw new Error(`solveMate: unsupported entity pair escaped filter: ${ref.type}-${dep.type}`);
|
|
2461
|
+
return pose;
|
|
2462
|
+
}
|
|
2460
2463
|
}
|
|
2461
2464
|
}
|
|
2462
2465
|
/**
|
|
@@ -50,7 +50,12 @@ export interface JointOptions {
|
|
|
50
50
|
export interface CylindricalOptions {
|
|
51
51
|
/** Rotation DOF (degrees). Default range -180..180. */
|
|
52
52
|
rotation?: JointOptions;
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Translation DOF (length). Default range 0..100, matching `prismaticJoint`
|
|
55
|
+
* (both model a slide along an axis). This is deliberately asymmetric with
|
|
56
|
+
* `planarJoint`'s in-plane translations, which default to -100..100 because
|
|
57
|
+
* an unanchored in-plane slide is naturally bidirectional.
|
|
58
|
+
*/
|
|
54
59
|
translation?: JointOptions;
|
|
55
60
|
}
|
|
56
61
|
/** Per-DOF ranges for a planar joint (two in-plane translations + a rotation). */
|
package/dist/operations.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_threadFns = require("./threadFns-
|
|
2
|
+
const require_threadFns = require("./threadFns-By0Gy2f9.cjs");
|
|
3
3
|
const require_loftFns = require("./loftFns-DiSsI2PM.cjs");
|
|
4
4
|
exports.addChild = require_threadFns.addChild;
|
|
5
5
|
exports.addJoint = require_threadFns.addJoint;
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as walkAssembly, C as mechanismDOF, D as setJointValue, E as revoluteJoint, F as countNodes, G as createAssembly, H as gridPattern, I as createAssemblyNode, L as findNode, N as addChild, O as setJointValues, P as collectShapes, R as removeChild, S as jointTransform, T as prismaticJoint, U as linearPattern, V as circularPattern, W as exportAssemblySTEP, _ as inverseKinematics, b as cylindricalJoint, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, k as sphericalJoint, 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 jointTrajectory, w as planarJoint, x as forwardKinematics, y as addJoint, z as updateNode } from "./threadFns-
|
|
1
|
+
import { B as walkAssembly, C as mechanismDOF, D as setJointValue, E as revoluteJoint, F as countNodes, G as createAssembly, H as gridPattern, I as createAssemblyNode, L as findNode, N as addChild, O as setJointValues, P as collectShapes, R as removeChild, S as jointTransform, T as prismaticJoint, U as linearPattern, V as circularPattern, W as exportAssemblySTEP, _ as inverseKinematics, b as cylindricalJoint, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, k as sphericalJoint, 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 jointTrajectory, w as planarJoint, x as forwardKinematics, y as addJoint, z as updateNode } from "./threadFns-YzJhd0Kz.js";
|
|
2
2
|
import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-CsHOwded.js";
|
|
3
3
|
export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, inverseKinematics, jointTrajectory, jointTransform, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
@@ -837,23 +837,30 @@ function residualTwist(out, pose, target, tip, m) {
|
|
|
837
837
|
for (let i = 0; i < m; i++) s += el(out, i) ** 2;
|
|
838
838
|
return Math.sqrt(s);
|
|
839
839
|
}
|
|
840
|
-
/**
|
|
841
|
-
|
|
840
|
+
/**
|
|
841
|
+
* Finite-difference Jacobian: column `j` is the end-effector twist from δq[j].
|
|
842
|
+
* The probe steps *inward* from a bound — `forwardKinematics` clamps each DOF to
|
|
843
|
+
* its range, so a forward `+eps` at the upper limit would yield a zero column and
|
|
844
|
+
* trap the solver at the ceiling. Stepping `-eps` there (and dividing by the
|
|
845
|
+
* signed step) keeps every column a true one-sided derivative.
|
|
846
|
+
*/
|
|
847
|
+
function fillJacobian(J, q, n, m, lo, hi, base, tip, eps, tipPose) {
|
|
842
848
|
const basePos = applyPose(base, tip);
|
|
843
849
|
for (let j = 0; j < n; j++) {
|
|
844
850
|
const saved = el(q, j);
|
|
845
|
-
|
|
851
|
+
const h = saved + eps > el(hi, j) && saved - eps >= el(lo, j) ? -eps : eps;
|
|
852
|
+
q[j] = saved + h;
|
|
846
853
|
const p2 = tipPose(q);
|
|
847
854
|
q[j] = saved;
|
|
848
855
|
const pos2 = applyPose(p2, tip);
|
|
849
|
-
J[j] = (pos2[0] - basePos[0]) /
|
|
850
|
-
J[n + j] = (pos2[1] - basePos[1]) /
|
|
851
|
-
J[2 * n + j] = (pos2[2] - basePos[2]) /
|
|
856
|
+
J[j] = (pos2[0] - basePos[0]) / h;
|
|
857
|
+
J[n + j] = (pos2[1] - basePos[1]) / h;
|
|
858
|
+
J[2 * n + j] = (pos2[2] - basePos[2]) / h;
|
|
852
859
|
if (m === 6) {
|
|
853
860
|
const dr = rotationError(base.rotation, p2.rotation);
|
|
854
|
-
J[3 * n + j] = dr[0] /
|
|
855
|
-
J[4 * n + j] = dr[1] /
|
|
856
|
-
J[5 * n + j] = dr[2] /
|
|
861
|
+
J[3 * n + j] = dr[0] / h;
|
|
862
|
+
J[4 * n + j] = dr[1] / h;
|
|
863
|
+
J[5 * n + j] = dr[2] / h;
|
|
857
864
|
}
|
|
858
865
|
}
|
|
859
866
|
}
|
|
@@ -906,7 +913,7 @@ function inverseKinematics(assembly, endEffector, target, options = {}) {
|
|
|
906
913
|
let err = residualTwist(e, pose, target, tip, m);
|
|
907
914
|
let iter = 0;
|
|
908
915
|
for (; iter < maxIterations && n > 0 && err > tolerance; iter++) {
|
|
909
|
-
fillJacobian(J, q, n, m, pose, tip, eps, tipPose);
|
|
916
|
+
fillJacobian(J, q, n, m, lo, hi, pose, tip, eps, tipPose);
|
|
910
917
|
const dq = dlsStep(J, e, n, m, lambda);
|
|
911
918
|
if (!dq) break;
|
|
912
919
|
for (let j = 0; j < n; j++) {
|
|
@@ -837,23 +837,30 @@ function residualTwist(out, pose, target, tip, m) {
|
|
|
837
837
|
for (let i = 0; i < m; i++) s += el(out, i) ** 2;
|
|
838
838
|
return Math.sqrt(s);
|
|
839
839
|
}
|
|
840
|
-
/**
|
|
841
|
-
|
|
840
|
+
/**
|
|
841
|
+
* Finite-difference Jacobian: column `j` is the end-effector twist from δq[j].
|
|
842
|
+
* The probe steps *inward* from a bound — `forwardKinematics` clamps each DOF to
|
|
843
|
+
* its range, so a forward `+eps` at the upper limit would yield a zero column and
|
|
844
|
+
* trap the solver at the ceiling. Stepping `-eps` there (and dividing by the
|
|
845
|
+
* signed step) keeps every column a true one-sided derivative.
|
|
846
|
+
*/
|
|
847
|
+
function fillJacobian(J, q, n, m, lo, hi, base, tip, eps, tipPose) {
|
|
842
848
|
const basePos = applyPose(base, tip);
|
|
843
849
|
for (let j = 0; j < n; j++) {
|
|
844
850
|
const saved = el(q, j);
|
|
845
|
-
|
|
851
|
+
const h = saved + eps > el(hi, j) && saved - eps >= el(lo, j) ? -eps : eps;
|
|
852
|
+
q[j] = saved + h;
|
|
846
853
|
const p2 = tipPose(q);
|
|
847
854
|
q[j] = saved;
|
|
848
855
|
const pos2 = applyPose(p2, tip);
|
|
849
|
-
J[j] = (pos2[0] - basePos[0]) /
|
|
850
|
-
J[n + j] = (pos2[1] - basePos[1]) /
|
|
851
|
-
J[2 * n + j] = (pos2[2] - basePos[2]) /
|
|
856
|
+
J[j] = (pos2[0] - basePos[0]) / h;
|
|
857
|
+
J[n + j] = (pos2[1] - basePos[1]) / h;
|
|
858
|
+
J[2 * n + j] = (pos2[2] - basePos[2]) / h;
|
|
852
859
|
if (m === 6) {
|
|
853
860
|
const dr = rotationError(base.rotation, p2.rotation);
|
|
854
|
-
J[3 * n + j] = dr[0] /
|
|
855
|
-
J[4 * n + j] = dr[1] /
|
|
856
|
-
J[5 * n + j] = dr[2] /
|
|
861
|
+
J[3 * n + j] = dr[0] / h;
|
|
862
|
+
J[4 * n + j] = dr[1] / h;
|
|
863
|
+
J[5 * n + j] = dr[2] / h;
|
|
857
864
|
}
|
|
858
865
|
}
|
|
859
866
|
}
|
|
@@ -906,7 +913,7 @@ function inverseKinematics(assembly, endEffector, target, options = {}) {
|
|
|
906
913
|
let err = residualTwist(e, pose, target, tip, m);
|
|
907
914
|
let iter = 0;
|
|
908
915
|
for (; iter < maxIterations && n > 0 && err > tolerance; iter++) {
|
|
909
|
-
fillJacobian(J, q, n, m, pose, tip, eps, tipPose);
|
|
916
|
+
fillJacobian(J, q, n, m, lo, hi, pose, tip, eps, tipPose);
|
|
910
917
|
const dq = dlsStep(J, e, n, m, lambda);
|
|
911
918
|
if (!dq) break;
|
|
912
919
|
for (let j = 0; j < n; j++) {
|