brepjs 18.81.1 → 18.82.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/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{blueprint-BQmmwEKa.js → blueprint-DYSvNd4o.js} +5 -5
- package/dist/{blueprint-B59GQsSD.cjs → blueprint-nc1fOuKL.cjs} +5 -5
- package/dist/{blueprintFns-DSK1nrwo.js → blueprintFns-BCwcL8yU.js} +2 -2
- package/dist/{blueprintFns-C1kKA5qn.cjs → blueprintFns-DfWBxCq0.cjs} +2 -2
- package/dist/{blueprintSketcher-BJPBKhF3.cjs → blueprintSketcher-B-3xs7WQ.cjs} +3 -3
- package/dist/{blueprintSketcher-EYqKWQh0.js → blueprintSketcher-CAW_XLlt.js} +3 -3
- package/dist/{boolean2D-COHH5tLX.js → boolean2D-DNJmkzwX.js} +4 -4
- package/dist/{boolean2D-B1Di3Bpn.cjs → boolean2D-KbMyZhkl.cjs} +4 -4
- package/dist/brepjs.cjs +28 -25
- package/dist/brepjs.js +26 -26
- package/dist/{cameraFns-BZ_8L3gd.cjs → cameraFns-B6TZAVBS.cjs} +2 -2
- package/dist/{cameraFns-BMrhkkOV.js → cameraFns-DVHzAi9k.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-Fi7obttG.js → cornerFinder-CTjcdE3-.js} +1 -1
- package/dist/{cornerFinder-Ey3oibK1.cjs → cornerFinder-_Ob4SRyO.cjs} +1 -1
- package/dist/{curveFns-Ca59CNS0.cjs → curveFns-DbD2YJ13.cjs} +1 -1
- package/dist/{curveFns-CoD5E2Vl.js → curveFns-sKYw6m8M.js} +1 -1
- package/dist/{drawFns-D_LwehLr.js → drawFns-CEPVoNO2.js} +12 -12
- package/dist/{drawFns-DTpCthM5.cjs → drawFns-QFxOvbxQ.cjs} +12 -12
- package/dist/{faceFns-Cuxdy-7R.js → faceFns-CGE7tH4w.js} +2 -2
- package/dist/{faceFns-0sI6cbHe.cjs → faceFns-lCFbFZoJ.cjs} +2 -2
- package/dist/{healingFns-Bm-NdBj_.js → healingFns-DLgqleYe.js} +5 -5
- package/dist/{healingFns--PtL9j2K.cjs → healingFns-GDygrmEZ.cjs} +5 -5
- package/dist/{helpers-B8mE35Fm.cjs → helpers-CgnVqLn7.cjs} +6 -6
- package/dist/{helpers-CD8EMZ5l.js → helpers-CmB_i8jR.js} +6 -6
- package/dist/{importFns-vnxBqXwv.js → importFns-CCf9yq82.js} +2 -2
- package/dist/{importFns-BHEgzDLw.cjs → importFns-D95ntTc4.cjs} +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-DiSsI2PM.cjs → loftFns-B1rnJSS9.cjs} +1 -1
- package/dist/{loftFns-CsHOwded.js → loftFns-BXoTCIjU.js} +1 -1
- package/dist/{measureFns-nF-OXcDV.cjs → measureFns-BhqwziaR.cjs} +3 -3
- package/dist/{measureFns-CdcufPNp.js → measureFns-DWuQ69pP.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BCgtjlbs.js → meshFns-BpZaGQen.js} +3 -3
- package/dist/{meshFns-CnckZa6H.cjs → meshFns-asBOhb1B.cjs} +3 -3
- package/dist/{occtWasmAdapter-W86SRBpi.cjs → occtWasmAdapter-5hzzhkME.cjs} +3 -1
- package/dist/{occtWasmAdapter-BrTkhQYK.js → occtWasmAdapter-BMV179Ji.js} +3 -1
- package/dist/operations/dhFns.d.ts +34 -0
- package/dist/operations/jointFns.d.ts +7 -0
- package/dist/operations/urdfFns.d.ts +33 -0
- package/dist/operations.cjs +5 -2
- package/dist/operations.d.ts +2 -0
- package/dist/operations.js +3 -3
- package/dist/{primitiveFns-BSKbI4Kl.js → primitiveFns-BvhWliRA.js} +5 -5
- package/dist/{primitiveFns-DEBQdEkG.cjs → primitiveFns-CtlwDr67.cjs} +5 -5
- 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-BzlBMNRO.js → shapeFns-BDE-a54O.js} +2 -2
- package/dist/{shapeFns-CecvqmYJ.cjs → shapeFns-B_jJcU_6.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-BDACYYRr.cjs → shapeRefFns-BoVBUAL3.cjs} +4 -4
- package/dist/{shapeRefFns-CpRRMBKz.js → shapeRefFns-CHzb4b94.js} +4 -4
- package/dist/{shapeTypes-DfQi9Kvk.js → shapeTypes-CIyYAXl9.js} +1 -1
- package/dist/{shapeTypes-DWxL75W3.cjs → shapeTypes-D7OMlW79.cjs} +1 -1
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-osLCTRG0.cjs → solidBuilders-CwM49RI7.cjs} +2 -2
- package/dist/{solidBuilders-DnIrQYZd.js → solidBuilders-D10YA4nh.js} +2 -2
- package/dist/{surfaceBuilders-hTXdNCYm.js → surfaceBuilders-D8mMa19A.js} +2 -2
- package/dist/{surfaceBuilders-B8aVZamB.cjs → surfaceBuilders-D_CoR7GM.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CI3k7Izc.cjs → textBlueprints-B8qqMC0Q.cjs} +7 -7
- package/dist/{textBlueprints-BpqDGwdx.js → textBlueprints-BXMr-Bbx.js} +7 -7
- package/dist/{textMetrics-C4RrG9jL.cjs → textMetrics-CMDiXmaV.cjs} +1 -1
- package/dist/{textMetrics-kFw-DE2w.js → textMetrics-Duye7Kw_.js} +1 -1
- package/dist/{threadFns-By0Gy2f9.cjs → threadFns-BvoPZ4ei.cjs} +281 -8
- package/dist/{threadFns-YzJhd0Kz.js → threadFns-D5dsDFQ5.js} +265 -10
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-DfOxu8tG.cjs → topologyQueryFns-BQq-qkqb.cjs} +1 -1
- package/dist/{topologyQueryFns-CqjEReSt.js → topologyQueryFns-DIKovx5V.js} +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as createKernelHandle, R as DisposalScope, Y as _usingCtx, Z as getKernel, t as castShape } from "./shapeTypes-
|
|
2
|
-
import { A as ok, T as isOk, b as err, d as validationError, n as computationError, r as ioError } from "./errors-DNWJsfVU.js";
|
|
1
|
+
import { B as createKernelHandle, R as DisposalScope, Y as _usingCtx, Z as getKernel, t as castShape } from "./shapeTypes-CIyYAXl9.js";
|
|
2
|
+
import { A as ok, T as isOk, b as err, d as validationError, n as computationError, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
|
|
4
|
-
import { y as fromBREP } from "./faceFns-
|
|
5
|
-
import { s as toBREP } from "./shapeFns-
|
|
6
|
-
import { E as wire, M as fuseAll, h as line } from "./primitiveFns-
|
|
7
|
-
import { t as loft } from "./loftFns-
|
|
4
|
+
import { y as fromBREP } from "./faceFns-CGE7tH4w.js";
|
|
5
|
+
import { s as toBREP } from "./shapeFns-BDE-a54O.js";
|
|
6
|
+
import { E as wire, M as fuseAll, h as line } from "./primitiveFns-BvhWliRA.js";
|
|
7
|
+
import { t as loft } from "./loftFns-BXoTCIjU.js";
|
|
8
8
|
//#region src/utils/uuid.ts
|
|
9
9
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
10
10
|
function uuidv() {
|
|
@@ -344,7 +344,7 @@ function quatMultiply(a, b) {
|
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/operations/jointFns.ts
|
|
347
|
-
var DEG2RAD = Math.PI / 180;
|
|
347
|
+
var DEG2RAD$2 = Math.PI / 180;
|
|
348
348
|
function clamp(value, min, max) {
|
|
349
349
|
return Math.min(max, Math.max(min, value));
|
|
350
350
|
}
|
|
@@ -539,7 +539,7 @@ function dofPose(origin, dof, value) {
|
|
|
539
539
|
0
|
|
540
540
|
]
|
|
541
541
|
};
|
|
542
|
-
const rotation = quatFromAxisAngle(dof.axis, value * DEG2RAD);
|
|
542
|
+
const rotation = quatFromAxisAngle(dof.axis, value * DEG2RAD$2);
|
|
543
543
|
const ro = quatRotate(rotation, origin);
|
|
544
544
|
return {
|
|
545
545
|
position: [
|
|
@@ -653,7 +653,8 @@ function forwardKinematics(assembly, jointValues = {}) {
|
|
|
653
653
|
progress = true;
|
|
654
654
|
if (poses.has(j.child)) continue;
|
|
655
655
|
const value = jointValues[j.child] ?? j.value;
|
|
656
|
-
|
|
656
|
+
const local = j.offset ? composePose(jointTransform(j, value), j.offset) : jointTransform(j, value);
|
|
657
|
+
poses.set(j.child, composePose(parentPose, local));
|
|
657
658
|
}
|
|
658
659
|
}
|
|
659
660
|
for (const j of pending) if (!poses.has(j.child)) poses.set(j.child, IDENTITY_POSE$1);
|
|
@@ -969,6 +970,260 @@ function jointTrajectory(assembly, from, to, steps) {
|
|
|
969
970
|
return samples;
|
|
970
971
|
}
|
|
971
972
|
//#endregion
|
|
973
|
+
//#region src/operations/dhFns.ts
|
|
974
|
+
/**
|
|
975
|
+
* Denavit-Hartenberg interchange: build a brepjs joint chain from a standard
|
|
976
|
+
* (distal) DH parameter table.
|
|
977
|
+
*
|
|
978
|
+
* Each DH row maps the previous link frame to the next via
|
|
979
|
+
* `Rz(θ) · Tz(d) · Tx(a) · Rx(α)`, with one parameter the joint variable
|
|
980
|
+
* (θ for revolute, d for prismatic) and the rest fixed link geometry. A row
|
|
981
|
+
* becomes a single revolute/prismatic joint whose motion is the variable part
|
|
982
|
+
* and whose fixed link geometry rides on the joint's post-motion `offset`
|
|
983
|
+
* (see `Joint.offset`), so the chain composes correctly through
|
|
984
|
+
* `forwardKinematics` and each row contributes exactly one DOF.
|
|
985
|
+
*/
|
|
986
|
+
var DEG2RAD$1 = Math.PI / 180;
|
|
987
|
+
/**
|
|
988
|
+
* The fixed DH link transform `Rz(θ) · Tz(d) · Tx(a) · Rx(α)` as a pose.
|
|
989
|
+
* Carries the constant link geometry that rides on the joint's `offset`.
|
|
990
|
+
*/
|
|
991
|
+
function linkOffset(thetaDeg, d, a, alphaDeg) {
|
|
992
|
+
const theta = thetaDeg * DEG2RAD$1;
|
|
993
|
+
const alpha = alphaDeg * DEG2RAD$1;
|
|
994
|
+
const rotation = quatMultiply(quatFromAxisAngle([
|
|
995
|
+
0,
|
|
996
|
+
0,
|
|
997
|
+
1
|
|
998
|
+
], theta), quatFromAxisAngle([
|
|
999
|
+
1,
|
|
1000
|
+
0,
|
|
1001
|
+
0
|
|
1002
|
+
], alpha));
|
|
1003
|
+
return {
|
|
1004
|
+
position: [
|
|
1005
|
+
a * Math.cos(theta),
|
|
1006
|
+
a * Math.sin(theta),
|
|
1007
|
+
d
|
|
1008
|
+
],
|
|
1009
|
+
rotation
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Build a serial revolute/prismatic joint chain from a DH table. Joint `i`
|
|
1014
|
+
* connects the previous link to row `i`'s link; its motion is the variable
|
|
1015
|
+
* parameter (θ for revolute, d for prismatic) about/along +z, and its fixed
|
|
1016
|
+
* link geometry is carried on `Joint.offset`. The result drives correctly
|
|
1017
|
+
* through `forwardKinematics` and reports `rows.length` DOF via `mechanismDOF`.
|
|
1018
|
+
*/
|
|
1019
|
+
function jointsFromDH(rows, options = {}) {
|
|
1020
|
+
const base = options.base ?? "base";
|
|
1021
|
+
const names = rows.map((r, i) => r.name ?? `link${i + 1}`);
|
|
1022
|
+
return rows.map((row, i) => {
|
|
1023
|
+
const parent = i === 0 ? base : names[i - 1] ?? `link${i}`;
|
|
1024
|
+
const child = names[i] ?? `link${i + 1}`;
|
|
1025
|
+
const offset = linkOffset(row.theta, row.d, row.a, row.alpha);
|
|
1026
|
+
const axis = {
|
|
1027
|
+
origin: [
|
|
1028
|
+
0,
|
|
1029
|
+
0,
|
|
1030
|
+
0
|
|
1031
|
+
],
|
|
1032
|
+
direction: [
|
|
1033
|
+
0,
|
|
1034
|
+
0,
|
|
1035
|
+
1
|
|
1036
|
+
]
|
|
1037
|
+
};
|
|
1038
|
+
const opts = {
|
|
1039
|
+
...row.min !== void 0 ? { min: row.min } : {},
|
|
1040
|
+
...row.max !== void 0 ? { max: row.max } : {},
|
|
1041
|
+
...row.value !== void 0 ? { value: row.value } : {}
|
|
1042
|
+
};
|
|
1043
|
+
return {
|
|
1044
|
+
...row.type === "prismatic" ? prismaticJoint(parent, child, axis, opts) : revoluteJoint(parent, child, axis, opts),
|
|
1045
|
+
offset
|
|
1046
|
+
};
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/operations/urdfFns.ts
|
|
1051
|
+
/**
|
|
1052
|
+
* URDF interchange: export a brepjs assembly + its joints to URDF, and import a
|
|
1053
|
+
* URDF document back into links and joints.
|
|
1054
|
+
*
|
|
1055
|
+
* URDF natively models single-DOF joints, so `revolute` and `prismatic` joints
|
|
1056
|
+
* round-trip (parents, axes, and limits preserved). Multi-DOF joints
|
|
1057
|
+
* (cylindrical/planar/spherical) and joints carrying a fixed `offset` (e.g.
|
|
1058
|
+
* Denavit-Hartenberg links) have no faithful single-joint URDF representation
|
|
1059
|
+
* and are reported as an error on export.
|
|
1060
|
+
*
|
|
1061
|
+
* Revolute limits are radians in URDF and degrees in brepjs, so they are
|
|
1062
|
+
* converted on the boundary. The XML is parsed with a small URDF-shaped reader
|
|
1063
|
+
* (no XML dependency); it handles the standard `<robot>/<link>/<joint>` subset.
|
|
1064
|
+
*/
|
|
1065
|
+
var DEG2RAD = Math.PI / 180;
|
|
1066
|
+
var RAD2DEG = 180 / Math.PI;
|
|
1067
|
+
function escapeXml(s) {
|
|
1068
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1069
|
+
}
|
|
1070
|
+
/** Format a number for XML, normalizing -0 to 0. */
|
|
1071
|
+
function fmt(n) {
|
|
1072
|
+
return String(n === 0 ? 0 : n);
|
|
1073
|
+
}
|
|
1074
|
+
function vec(v) {
|
|
1075
|
+
return `${fmt(v[0])} ${fmt(v[1])} ${fmt(v[2])}`;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Serialize an assembly's links and revolute/prismatic joints to a URDF string.
|
|
1079
|
+
* Returns an error if any joint is multi-DOF or carries a fixed `offset`, since
|
|
1080
|
+
* URDF cannot represent those as a single joint.
|
|
1081
|
+
*/
|
|
1082
|
+
function exportURDF(assembly, options = {}) {
|
|
1083
|
+
const robot = options.name ?? "robot";
|
|
1084
|
+
const effort = options.effort ?? 0;
|
|
1085
|
+
const velocity = options.velocity ?? 0;
|
|
1086
|
+
const meshes = options.meshes ?? {};
|
|
1087
|
+
const links = [];
|
|
1088
|
+
const joints = [];
|
|
1089
|
+
walkAssembly(assembly, (n) => {
|
|
1090
|
+
links.push(n.name);
|
|
1091
|
+
if (n.joints) joints.push(...n.joints);
|
|
1092
|
+
});
|
|
1093
|
+
for (const j of joints) {
|
|
1094
|
+
if (j.type !== "revolute" && j.type !== "prismatic") return err(validationError(BrepErrorCode.VALIDATION_FAILED, `exportURDF: joint '${j.parent}->${j.child}' is '${j.type}'; URDF supports only revolute and prismatic joints`));
|
|
1095
|
+
if (j.offset) return err(validationError(BrepErrorCode.VALIDATION_FAILED, `exportURDF: joint '${j.parent}->${j.child}' carries a fixed offset (e.g. a DH link) that URDF cannot represent as a single joint`));
|
|
1096
|
+
}
|
|
1097
|
+
const lines = ["<?xml version=\"1.0\"?>", `<robot name="${escapeXml(robot)}">`];
|
|
1098
|
+
for (const link of links) {
|
|
1099
|
+
const mesh = meshes[link];
|
|
1100
|
+
if (mesh) lines.push(` <link name="${escapeXml(link)}">`, ` <visual><geometry><mesh filename="${escapeXml(mesh)}"/></geometry></visual>`, ` </link>`);
|
|
1101
|
+
else lines.push(` <link name="${escapeXml(link)}"/>`);
|
|
1102
|
+
}
|
|
1103
|
+
for (const j of joints) {
|
|
1104
|
+
const toRad = j.type === "revolute";
|
|
1105
|
+
const lower = toRad ? j.min * DEG2RAD : j.min;
|
|
1106
|
+
const upper = toRad ? j.max * DEG2RAD : j.max;
|
|
1107
|
+
const origin = j.type === "prismatic" ? [
|
|
1108
|
+
0,
|
|
1109
|
+
0,
|
|
1110
|
+
0
|
|
1111
|
+
] : j.axis.origin;
|
|
1112
|
+
lines.push(` <joint name="${escapeXml(`${j.parent}_to_${j.child}`)}" type="${j.type}">`, ` <parent link="${escapeXml(j.parent)}"/>`, ` <child link="${escapeXml(j.child)}"/>`, ` <origin xyz="${vec(origin)}" rpy="0 0 0"/>`, ` <axis xyz="${vec(j.axis.direction)}"/>`, ` <limit lower="${fmt(lower)}" upper="${fmt(upper)}" effort="${fmt(effort)}" velocity="${fmt(velocity)}"/>`, ` </joint>`);
|
|
1113
|
+
}
|
|
1114
|
+
lines.push("</robot>", "");
|
|
1115
|
+
return ok(lines.join("\n"));
|
|
1116
|
+
}
|
|
1117
|
+
/** Read a string attribute from a tag's attribute text. */
|
|
1118
|
+
function attr(text, name) {
|
|
1119
|
+
return new RegExp(`\\b${name}\\s*=\\s*"([^"]*)"`).exec(text)?.[1];
|
|
1120
|
+
}
|
|
1121
|
+
/** Parse a whitespace-separated numeric triple, defaulting missing components to 0. */
|
|
1122
|
+
function triple(s, fallback) {
|
|
1123
|
+
if (!s) return fallback;
|
|
1124
|
+
const parts = s.trim().split(/\s+/).map(Number);
|
|
1125
|
+
return [
|
|
1126
|
+
parts[0] ?? 0,
|
|
1127
|
+
parts[1] ?? 0,
|
|
1128
|
+
parts[2] ?? 0
|
|
1129
|
+
];
|
|
1130
|
+
}
|
|
1131
|
+
/** Rotate an axis by a URDF roll-pitch-yaw (fixed-axis XYZ) triple in radians. */
|
|
1132
|
+
function applyRpy(axis, rpy) {
|
|
1133
|
+
return quatRotate(quatMultiply(quatMultiply(quatFromAxisAngle([
|
|
1134
|
+
0,
|
|
1135
|
+
0,
|
|
1136
|
+
1
|
|
1137
|
+
], rpy[2]), quatFromAxisAngle([
|
|
1138
|
+
0,
|
|
1139
|
+
1,
|
|
1140
|
+
0
|
|
1141
|
+
], rpy[1])), quatFromAxisAngle([
|
|
1142
|
+
1,
|
|
1143
|
+
0,
|
|
1144
|
+
0
|
|
1145
|
+
], rpy[0])), axis);
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Parse a URDF document into its robot name, link names, and revolute/prismatic
|
|
1149
|
+
* joints. `continuous` joints become revolute with a full -180..180 range;
|
|
1150
|
+
* `fixed`/`floating`/`planar` joints are skipped (their links are still listed).
|
|
1151
|
+
* A non-zero `<origin rpy>` is folded into the joint axis direction; its
|
|
1152
|
+
* residual frame rotation is not represented (URDF's pre-motion frame offset has
|
|
1153
|
+
* no single-joint brepjs equivalent).
|
|
1154
|
+
*/
|
|
1155
|
+
function importURDF(xml) {
|
|
1156
|
+
const robotMatch = /<robot\b([^>]*)>/.exec(xml);
|
|
1157
|
+
if (!robotMatch) return err(validationError(BrepErrorCode.VALIDATION_FAILED, "importURDF: no <robot> element found"));
|
|
1158
|
+
const name = attr(robotMatch[1] ?? "", "name") ?? "robot";
|
|
1159
|
+
const links = [];
|
|
1160
|
+
const linkRe = /<link\b([^>]*?)(?:\/>|>)/g;
|
|
1161
|
+
for (let m = linkRe.exec(xml); m; m = linkRe.exec(xml)) {
|
|
1162
|
+
const n = attr(m[1] ?? "", "name");
|
|
1163
|
+
if (n) links.push(n);
|
|
1164
|
+
}
|
|
1165
|
+
const joints = [];
|
|
1166
|
+
const jointRe = /<joint\b([^>]*)>([\s\S]*?)<\/joint>/g;
|
|
1167
|
+
for (let m = jointRe.exec(xml); m; m = jointRe.exec(xml)) {
|
|
1168
|
+
const head = m[1] ?? "";
|
|
1169
|
+
const body = m[2] ?? "";
|
|
1170
|
+
const type = attr(head, "type") ?? "fixed";
|
|
1171
|
+
if (type === "fixed" || type === "floating" || type === "planar") continue;
|
|
1172
|
+
const parentTag = /<parent\b([^>]*?)\/?>/.exec(body);
|
|
1173
|
+
const childTag = /<child\b([^>]*?)\/?>/.exec(body);
|
|
1174
|
+
const parent = attr(parentTag?.[1] ?? "", "link");
|
|
1175
|
+
const child = attr(childTag?.[1] ?? "", "link");
|
|
1176
|
+
if (!parent || !child) return err(validationError(BrepErrorCode.VALIDATION_FAILED, `importURDF: joint missing parent/child link (${attr(head, "name") ?? "unnamed"})`));
|
|
1177
|
+
const originTag = /<origin\b([^>]*?)\/?>/.exec(body);
|
|
1178
|
+
const axisTag = /<axis\b([^>]*?)\/?>/.exec(body);
|
|
1179
|
+
const limitTag = /<limit\b([^>]*?)\/?>/.exec(body);
|
|
1180
|
+
const origin = triple(attr(originTag?.[1] ?? "", "xyz"), [
|
|
1181
|
+
0,
|
|
1182
|
+
0,
|
|
1183
|
+
0
|
|
1184
|
+
]);
|
|
1185
|
+
const rpy = triple(attr(originTag?.[1] ?? "", "rpy"), [
|
|
1186
|
+
0,
|
|
1187
|
+
0,
|
|
1188
|
+
0
|
|
1189
|
+
]);
|
|
1190
|
+
const direction = applyRpy(triple(attr(axisTag?.[1] ?? "", "xyz"), [
|
|
1191
|
+
1,
|
|
1192
|
+
0,
|
|
1193
|
+
0
|
|
1194
|
+
]), rpy);
|
|
1195
|
+
const lowerRaw = Number(attr(limitTag?.[1] ?? "", "lower") ?? NaN);
|
|
1196
|
+
const upperRaw = Number(attr(limitTag?.[1] ?? "", "upper") ?? NaN);
|
|
1197
|
+
if (type === "prismatic") {
|
|
1198
|
+
const opts = Number.isFinite(lowerRaw) && Number.isFinite(upperRaw) ? {
|
|
1199
|
+
min: lowerRaw,
|
|
1200
|
+
max: upperRaw
|
|
1201
|
+
} : {};
|
|
1202
|
+
joints.push(prismaticJoint(parent, child, {
|
|
1203
|
+
origin,
|
|
1204
|
+
direction
|
|
1205
|
+
}, opts));
|
|
1206
|
+
} else if (type === "revolute" || type === "continuous") {
|
|
1207
|
+
const opts = type === "continuous" || !Number.isFinite(lowerRaw) || !Number.isFinite(upperRaw) ? {
|
|
1208
|
+
min: -180,
|
|
1209
|
+
max: 180
|
|
1210
|
+
} : {
|
|
1211
|
+
min: lowerRaw * RAD2DEG,
|
|
1212
|
+
max: upperRaw * RAD2DEG
|
|
1213
|
+
};
|
|
1214
|
+
joints.push(revoluteJoint(parent, child, {
|
|
1215
|
+
origin,
|
|
1216
|
+
direction
|
|
1217
|
+
}, opts));
|
|
1218
|
+
} else return err(validationError(BrepErrorCode.VALIDATION_FAILED, `importURDF: joint '${attr(head, "name") ?? "unnamed"}' has unrecognized type '${type}'`));
|
|
1219
|
+
}
|
|
1220
|
+
return ok({
|
|
1221
|
+
name,
|
|
1222
|
+
links,
|
|
1223
|
+
joints
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
//#endregion
|
|
972
1227
|
//#region src/operations/historyFns.ts
|
|
973
1228
|
/** Create a new empty history. */
|
|
974
1229
|
function createHistory() {
|
|
@@ -1236,4 +1491,4 @@ function thread(options) {
|
|
|
1236
1491
|
}
|
|
1237
1492
|
}
|
|
1238
1493
|
//#endregion
|
|
1239
|
-
export {
|
|
1494
|
+
export { setJointValue as A, findNode as B, cylindricalJoint as C, planarJoint as D, mechanismDOF as E, quatRotate as F, gridPattern as G, updateNode as H, addChild as I, createAssembly as J, linearPattern as K, collectShapes as L, sphericalJoint as M, quatFromAxisAngle as N, prismaticJoint as O, quatFromTo as P, countNodes as R, addJoint as S, jointTransform as T, walkAssembly as U, removeChild as V, circularPattern as W, exportURDF as _, deserializeHistory as a, inverseKinematics as b, modifyStep as c, replayFrom as d, replayHistory as f, undoLast as g, stepsFrom as h, createRegistry as i, setJointValues as j, revoluteJoint as k, registerOperation as l, stepCount as m, addStep as n, findStep as o, serializeHistory as p, exportAssemblySTEP as q, createHistory as r, getShape as s, thread as t, registerShape as u, importURDF as v, forwardKinematics as w, jointTrajectory as x, jointsFromDH as y, createAssemblyNode as z };
|
package/dist/topology.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
-
const require_faceFns = require("./faceFns-
|
|
4
|
-
const require_shapeFns = require("./shapeFns-
|
|
5
|
-
const require_curveFns = require("./curveFns-
|
|
6
|
-
const require_meshFns = require("./meshFns-
|
|
7
|
-
const require_primitiveFns = require("./primitiveFns-
|
|
8
|
-
const require_healingFns = require("./healingFns
|
|
2
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BQq-qkqb.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-lCFbFZoJ.cjs");
|
|
4
|
+
const require_shapeFns = require("./shapeFns-B_jJcU_6.cjs");
|
|
5
|
+
const require_curveFns = require("./curveFns-DbD2YJ13.cjs");
|
|
6
|
+
const require_meshFns = require("./meshFns-asBOhb1B.cjs");
|
|
7
|
+
const require_primitiveFns = require("./primitiveFns-CtlwDr67.cjs");
|
|
8
|
+
const require_healingFns = require("./healingFns-GDygrmEZ.cjs");
|
|
9
9
|
exports.addHoles = require_primitiveFns.addHoles;
|
|
10
10
|
exports.adjacentFaces = require_healingFns.adjacentFaces;
|
|
11
11
|
exports.approximateCurve = require_curveFns.approximateCurve;
|
package/dist/topology.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as vertexPosition, _ as iterFaces, b as iterVertices, c as getFaces, f as getVertices, g as iterEdges, m as invalidateShapeCache, n as getBounds, p as getWires, s as getEdges, x as iterWires } from "./topologyQueryFns-
|
|
2
|
-
import { S as shapeType, _ as cast, a as faceOrientation, b as isCompSolid, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, v as downcast, x as iterTopo, y as fromBREP } from "./faceFns-
|
|
3
|
-
import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-
|
|
4
|
-
import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-
|
|
5
|
-
import { c as createMeshCache, n as exportSTEP, r as exportSTL, s as clearMeshCache, t as exportIGES } from "./meshFns-
|
|
6
|
-
import { A as cutAll, C as threePointArc, D as wireLoop, E as wire, M as fuseAll, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, 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, x as subFace, y as solid } from "./primitiveFns-
|
|
7
|
-
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, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-
|
|
1
|
+
import { S as vertexPosition, _ as iterFaces, b as iterVertices, c as getFaces, f as getVertices, g as iterEdges, m as invalidateShapeCache, n as getBounds, p as getWires, s as getEdges, x as iterWires } from "./topologyQueryFns-DIKovx5V.js";
|
|
2
|
+
import { S as shapeType, _ as cast, a as faceOrientation, b as isCompSolid, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, v as downcast, x as iterTopo, y as fromBREP } from "./faceFns-CGE7tH4w.js";
|
|
3
|
+
import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-BDE-a54O.js";
|
|
4
|
+
import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-sKYw6m8M.js";
|
|
5
|
+
import { c as createMeshCache, n as exportSTEP, r as exportSTL, s as clearMeshCache, t as exportIGES } from "./meshFns-BpZaGQen.js";
|
|
6
|
+
import { A as cutAll, C as threePointArc, D as wireLoop, E as wire, M as fuseAll, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, 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, x as subFace, y as solid } from "./primitiveFns-BvhWliRA.js";
|
|
7
|
+
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, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-DLgqleYe.js";
|
|
8
8
|
export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D7OMlW79.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
//#region src/core/kernelCall.ts
|
|
4
4
|
function buildError(kind, code, message, cause, suggestion) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as getOrQueryType, R as DisposalScope, Y as _usingCtx, Z as getKernel, r as castShapeWithKnownType, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { N as getOrQueryType, R as DisposalScope, Y as _usingCtx, Z as getKernel, r as castShapeWithKnownType, t as castShape } from "./shapeTypes-CIyYAXl9.js";
|
|
2
2
|
import { A as ok, b as err, f as getSuggestionForCode, p as translateKernelError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
//#region src/core/kernelCall.ts
|
|
4
4
|
function buildError(kind, code, message, cause, suggestion) {
|