@margoengine/kinematics-constraints 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +441 -3
- package/dist/AvoidanceSolver.d.ts +203 -0
- package/dist/chain.d.ts +48 -0
- package/dist/chain.js +159 -0
- package/dist/errors-D5_2oB8I.js +7 -0
- package/dist/hull-RrgFbmB9.js +325 -0
- package/dist/hull.d.ts +62 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +300 -0
- package/dist/joint-limits.d.ts +34 -0
- package/dist/joint-limits.js +104 -0
- package/dist/multi-goal-math.d.ts +12 -0
- package/dist/multi-goal.d.ts +147 -0
- package/dist/multi-goal.js +313 -0
- package/dist/sdf.d.ts +121 -0
- package/dist/sdf.js +202 -0
- package/dist/shared/validate-vector.d.ts +2 -0
- package/dist/swept.d.ts +67 -0
- package/dist/swept.js +185 -0
- package/dist/types.d.ts +36 -0
- package/dist/validate-vector-7JTvvTtJ.js +15 -0
- package/dist/volumes-CpBBobtO.js +219 -0
- package/dist/volumes.d.ts +58 -0
- package/package.json +79 -6
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { n as e } from "./errors-D5_2oB8I.js";
|
|
2
|
+
//#region src/multi-goal-math.ts
|
|
3
|
+
var t = () => ({
|
|
4
|
+
position: [
|
|
5
|
+
0,
|
|
6
|
+
0,
|
|
7
|
+
0
|
|
8
|
+
],
|
|
9
|
+
rotation: [
|
|
10
|
+
0,
|
|
11
|
+
0,
|
|
12
|
+
0,
|
|
13
|
+
1
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
function n(e, t) {
|
|
17
|
+
return [
|
|
18
|
+
e[3] * t[0] + e[0] * t[3] + e[1] * t[2] - e[2] * t[1],
|
|
19
|
+
e[3] * t[1] - e[0] * t[2] + e[1] * t[3] + e[2] * t[0],
|
|
20
|
+
e[3] * t[2] + e[0] * t[1] - e[1] * t[0] + e[2] * t[3],
|
|
21
|
+
e[3] * t[3] - e[0] * t[0] - e[1] * t[1] - e[2] * t[2]
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
function r(e, t) {
|
|
25
|
+
let n = 2 * (e[1] * t[2] - e[2] * t[1]), r = 2 * (e[2] * t[0] - e[0] * t[2]), i = 2 * (e[0] * t[1] - e[1] * t[0]);
|
|
26
|
+
return [
|
|
27
|
+
t[0] + e[3] * n + e[1] * i - e[2] * r,
|
|
28
|
+
t[1] + e[3] * r + e[2] * n - e[0] * i,
|
|
29
|
+
t[2] + e[3] * i + e[0] * r - e[1] * n
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
function i(e, t) {
|
|
33
|
+
let i = r(e.rotation, t.position), a = n(e.rotation, t.rotation), o = Math.hypot(...a);
|
|
34
|
+
return {
|
|
35
|
+
position: i.map((t, n) => t + e.position[n]),
|
|
36
|
+
rotation: a.map((e) => e / o)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function a(e, t) {
|
|
40
|
+
let r = n(e, [
|
|
41
|
+
-t[0],
|
|
42
|
+
-t[1],
|
|
43
|
+
-t[2],
|
|
44
|
+
t[3]
|
|
45
|
+
]);
|
|
46
|
+
r[3] < 0 && (r = r.map((e) => -e));
|
|
47
|
+
let i = Math.hypot(r[0], r[1], r[2]), a = i > 1e-15 ? 2 * Math.atan2(i, r[3]) / i : 2;
|
|
48
|
+
return [
|
|
49
|
+
r[0] * a,
|
|
50
|
+
r[1] * a,
|
|
51
|
+
r[2] * a
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function o(e, t, n, r) {
|
|
55
|
+
let i = e.length, a = Array.from({ length: i }, (e, t) => t).filter((e) => !r.has(e)), o = a.length, s = new Float64Array(o * o), c = new Float64Array(o);
|
|
56
|
+
for (let r = 0; r < o; r++) {
|
|
57
|
+
let i = e[a[r]];
|
|
58
|
+
for (let e = 0; e < t.length; e++) c[r] -= i[e] * t[e];
|
|
59
|
+
for (let c = 0; c <= r; c++) {
|
|
60
|
+
let l = e[a[c]], u = r === c ? n * n : 0;
|
|
61
|
+
for (let e = 0; e < t.length; e++) u += i[e] * l[e];
|
|
62
|
+
for (let e = 0; e < c; e++) u -= s[r * o + e] * s[c * o + e];
|
|
63
|
+
s[r * o + c] = r === c ? Math.sqrt(Math.max(u, n * n * 1e-6)) : u / s[c * o + c];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (let e = 0; e < o; e++) {
|
|
67
|
+
for (let t = 0; t < e; t++) c[e] -= s[e * o + t] * c[t];
|
|
68
|
+
c[e] /= s[e * o + e];
|
|
69
|
+
}
|
|
70
|
+
let l = Array(i).fill(0);
|
|
71
|
+
for (let e = o - 1; e >= 0; e--) {
|
|
72
|
+
for (let t = e + 1; t < o; t++) c[e] -= s[t * o + e] * l[a[t]];
|
|
73
|
+
l[a[e]] = c[e] / s[e * o + e];
|
|
74
|
+
}
|
|
75
|
+
return l;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/multi-goal.ts
|
|
79
|
+
var s = (t) => {
|
|
80
|
+
throw e(`${t}; supply valid bounded IK data`, "kinematics");
|
|
81
|
+
}, c = (e) => Number.isFinite(e) && Math.abs(e) <= 1e6, l = (e, t) => Math.max(t.min, -1e6, Math.min(t.max, 1e6, e));
|
|
82
|
+
function u(e, t) {
|
|
83
|
+
return e === void 0 ? [...t] : ((e.length !== 3 || !e.every(c)) && s("Expected three finite coordinates of magnitude at most 1e6"), [...e]);
|
|
84
|
+
}
|
|
85
|
+
function d(e) {
|
|
86
|
+
if (e === void 0) return [
|
|
87
|
+
0,
|
|
88
|
+
0,
|
|
89
|
+
0,
|
|
90
|
+
1
|
|
91
|
+
];
|
|
92
|
+
(e.length !== 4 || !e.every(Number.isFinite)) && s("Expected a finite nonzero quaternion");
|
|
93
|
+
let t = Math.max(...e.map(Math.abs));
|
|
94
|
+
t === 0 && s("Expected a nonzero quaternion");
|
|
95
|
+
let n = e.map((e) => e / t), r = Math.hypot(...n);
|
|
96
|
+
return n.map((e) => e / r);
|
|
97
|
+
}
|
|
98
|
+
function f(e) {
|
|
99
|
+
return e === void 0 ? [
|
|
100
|
+
!0,
|
|
101
|
+
!0,
|
|
102
|
+
!0
|
|
103
|
+
] : ((e.length !== 3 || !e.every((e) => typeof e == "boolean")) && s("Expected three boolean axis flags"), [...e]);
|
|
104
|
+
}
|
|
105
|
+
function p(e = 1) {
|
|
106
|
+
return (!Number.isFinite(e) || e < 0 || e > 1e6) && s("Expected a weight in 0..1e6"), e;
|
|
107
|
+
}
|
|
108
|
+
var m = class {
|
|
109
|
+
constructor(e, t = {}) {
|
|
110
|
+
this.order = [], (!Array.isArray(e) || e.length < 1 || e.length > 256) && s("Expected 1..256 joints"), this.options = {
|
|
111
|
+
iterations: t?.iterations ?? 128,
|
|
112
|
+
candidates: t?.candidates ?? 4,
|
|
113
|
+
positionTolerance: t?.positionTolerance ?? 1e-5,
|
|
114
|
+
orientationTolerance: t?.orientationTolerance ?? 1e-5,
|
|
115
|
+
damping: t?.damping ?? .01,
|
|
116
|
+
maxStep: t?.maxStep ?? .25
|
|
117
|
+
};
|
|
118
|
+
let n = this.options;
|
|
119
|
+
(!Number.isInteger(n.iterations) || n.iterations < 1 || n.iterations > 4096 || !Number.isInteger(n.candidates) || n.candidates < 1 || n.candidates > 64 || !c(n.positionTolerance) || n.positionTolerance <= 0 || !c(n.orientationTolerance) || n.orientationTolerance <= 0 || !c(n.maxStep) || n.maxStep <= 0 || !Number.isFinite(n.damping) || n.damping < 1e-6 || n.damping > 1e3) && s("Invalid IK solver settings"), this.joints = e.map((t, n) => {
|
|
120
|
+
(!t || ![
|
|
121
|
+
"fixed",
|
|
122
|
+
"revolute",
|
|
123
|
+
"prismatic"
|
|
124
|
+
].includes(t.type)) && s("Expected fixed, revolute or prismatic joints");
|
|
125
|
+
let r = t.parent ?? -1, i = t.min ?? -Infinity, a = t.max ?? Infinity, o = t.value ?? 0;
|
|
126
|
+
(!Number.isInteger(r) || r < -1 || r >= e.length || r === n) && s("Invalid joint parent"), (!(i <= a) || i === Infinity || a === -Infinity || Number.isFinite(i) && !c(i) || Number.isFinite(a) && !c(a) || !c(o) || o < i || o > a) && s("Invalid joint value or bounds"), t.type === "fixed" && (o !== 0 || i > 0 || a < 0) && s("Fixed joint value must be zero");
|
|
127
|
+
let l = u(t.axis, [
|
|
128
|
+
0,
|
|
129
|
+
0,
|
|
130
|
+
1
|
|
131
|
+
]), f = Math.hypot(...l);
|
|
132
|
+
return f === 0 && s("Expected a nonzero joint axis"), {
|
|
133
|
+
type: t.type,
|
|
134
|
+
parent: r,
|
|
135
|
+
rest: {
|
|
136
|
+
position: u(t.position, [
|
|
137
|
+
0,
|
|
138
|
+
0,
|
|
139
|
+
0
|
|
140
|
+
]),
|
|
141
|
+
rotation: d(t.rotation)
|
|
142
|
+
},
|
|
143
|
+
axis: l.map((e) => e / f),
|
|
144
|
+
value: o,
|
|
145
|
+
min: i,
|
|
146
|
+
max: a
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
150
|
+
r.has(e) || (i.has(e) && s("Parent graph has a cycle; express closures with loops"), i.add(e), this.joints[e].parent >= 0 && a(this.joints[e].parent), i.delete(e), r.add(e), this.order.push(e));
|
|
151
|
+
};
|
|
152
|
+
e.forEach((e, t) => a(t)), this.variables = this.order.filter((e) => this.joints[e].type !== "fixed" && this.joints[e].min !== this.joints[e].max);
|
|
153
|
+
}
|
|
154
|
+
values(e) {
|
|
155
|
+
return e === void 0 ? this.joints.map((e) => e.value) : ((e.length !== this.joints.length || !e.every((e, t) => c(e) && e >= this.joints[t].min && e <= this.joints[t].max && (this.joints[t].type !== "fixed" || e === 0))) && s("Expected one in-bounds scalar per joint"), [...e]);
|
|
156
|
+
}
|
|
157
|
+
frame(e) {
|
|
158
|
+
return (!e || !Number.isInteger(e.joint) || e.joint < -1 || e.joint >= this.joints.length) && s("Invalid attachment joint"), {
|
|
159
|
+
joint: e.joint,
|
|
160
|
+
local: {
|
|
161
|
+
position: u(e.position, [
|
|
162
|
+
0,
|
|
163
|
+
0,
|
|
164
|
+
0
|
|
165
|
+
]),
|
|
166
|
+
rotation: d(e.rotation)
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
forward(e) {
|
|
171
|
+
let n = Array(this.joints.length);
|
|
172
|
+
for (let r of this.order) {
|
|
173
|
+
let a = this.joints[r], o = e[r], s = t();
|
|
174
|
+
a.type === "revolute" && (s.rotation = [
|
|
175
|
+
a.axis[0] * Math.sin(o / 2),
|
|
176
|
+
a.axis[1] * Math.sin(o / 2),
|
|
177
|
+
a.axis[2] * Math.sin(o / 2),
|
|
178
|
+
Math.cos(o / 2)
|
|
179
|
+
]), a.type === "prismatic" && (s.position = a.axis.map((e) => e * o)), n[r] = i(a.parent < 0 ? t() : n[a.parent], i(a.rest, s));
|
|
180
|
+
}
|
|
181
|
+
return n;
|
|
182
|
+
}
|
|
183
|
+
evaluate(e, t) {
|
|
184
|
+
let n = this.forward(this.values(e));
|
|
185
|
+
return t ? [this.attachment(this.frame(t), n)] : n;
|
|
186
|
+
}
|
|
187
|
+
attachment(e, n) {
|
|
188
|
+
return i(e.joint < 0 ? t() : n[e.joint], e.local);
|
|
189
|
+
}
|
|
190
|
+
constraints(e) {
|
|
191
|
+
let n = e.goals ?? [], r = e.loops ?? [];
|
|
192
|
+
(!Array.isArray(n) || !Array.isArray(r) || n.length + r.length > 256) && s("Expected at most 256 goals and loops");
|
|
193
|
+
let i = (e) => ({
|
|
194
|
+
pw: p(e.positionWeight),
|
|
195
|
+
ow: p(e.orientationWeight),
|
|
196
|
+
pa: f(e.positionAxes),
|
|
197
|
+
oa: f(e.orientationAxes)
|
|
198
|
+
}), a = n.map((e) => (e || s("Expected a goal"), {
|
|
199
|
+
a: this.frame(e.frame),
|
|
200
|
+
target: {
|
|
201
|
+
position: u(e.position, [
|
|
202
|
+
0,
|
|
203
|
+
0,
|
|
204
|
+
0
|
|
205
|
+
]),
|
|
206
|
+
rotation: d(e.rotation)
|
|
207
|
+
},
|
|
208
|
+
position: e.position !== void 0,
|
|
209
|
+
orientation: e.rotation !== void 0,
|
|
210
|
+
...i(e)
|
|
211
|
+
}));
|
|
212
|
+
for (let e of r) (!e || e.position !== void 0 && typeof e.position != "boolean" || e.orientation !== void 0 && typeof e.orientation != "boolean") && s("Expected boolean loop channels"), a.push({
|
|
213
|
+
a: this.frame(e.a),
|
|
214
|
+
b: this.frame(e.b),
|
|
215
|
+
target: t(),
|
|
216
|
+
position: e.position ?? !0,
|
|
217
|
+
orientation: e.orientation ?? !1,
|
|
218
|
+
...i(e)
|
|
219
|
+
});
|
|
220
|
+
for (let e of a) !(e.position && e.pw > 0 && e.pa.some(Boolean)) && !(e.orientation && e.ow > 0 && e.oa.some(Boolean)) && s("Each constraint needs an active channel");
|
|
221
|
+
return a;
|
|
222
|
+
}
|
|
223
|
+
residual(e, t, n) {
|
|
224
|
+
let r = this.forward(e), i = [], o = [], s = !0, c = 0;
|
|
225
|
+
for (let e of t) {
|
|
226
|
+
let t = this.attachment(e.a, r), l = e.b ? this.attachment(e.b, r) : e.target, u = t.position.map((e, t) => e - l.position[t]), d = a(t.rotation, l.rotation), f = 0, p = 0, m = c + (e.position && e.pw > 0 ? e.pa.filter(Boolean).length : 0);
|
|
227
|
+
if (n && e.orientation && e.ow > 0) {
|
|
228
|
+
let t = Math.hypot(...d), r = t > 0 ? d.map((e) => e * (1 - 2 * Math.PI / t)) : d, i = 0, a = 0, o = m;
|
|
229
|
+
for (let t = 0; t < 3; t++) if (e.oa[t]) {
|
|
230
|
+
let s = n.residual[o++] / Math.sqrt(e.ow);
|
|
231
|
+
i += (d[t] - s) ** 2, a += (r[t] - s) ** 2;
|
|
232
|
+
}
|
|
233
|
+
if (a < i) for (let e = 0; e < 3; e++) d[e] = r[e];
|
|
234
|
+
}
|
|
235
|
+
for (let t = 0; t < 3; t++) e.position && e.pw > 0 && e.pa[t] && (i.push(u[t] * Math.sqrt(e.pw)), f += u[t] * u[t], c++);
|
|
236
|
+
for (let t = 0; t < 3; t++) e.orientation && e.ow > 0 && e.oa[t] && (i.push(d[t] * Math.sqrt(e.ow)), p += d[t] * d[t], c++);
|
|
237
|
+
let h = {
|
|
238
|
+
position: Math.sqrt(f),
|
|
239
|
+
orientation: Math.sqrt(p)
|
|
240
|
+
};
|
|
241
|
+
o.push(h), s &&= h.position <= this.options.positionTolerance && h.orientation <= this.options.orientationTolerance;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
poses: r,
|
|
245
|
+
residual: i,
|
|
246
|
+
errors: o,
|
|
247
|
+
resolved: s,
|
|
248
|
+
objective: i.reduce((e, t) => e + t * t, 0)
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
solve(e = {}) {
|
|
252
|
+
e.signal?.throwIfAborted();
|
|
253
|
+
let t = this.constraints(e), n = this.values(e.values), r = this.options, i = [...n], a = this.residual(n, t), s = 0, c = 0, u = !1;
|
|
254
|
+
for (let d = 0; d < r.candidates && !a.resolved; d++) {
|
|
255
|
+
c++;
|
|
256
|
+
let f = [...n];
|
|
257
|
+
if (d > 0) for (let e of this.variables) {
|
|
258
|
+
let t = this.joints[e], n = Number.isFinite(t.max - t.min) ? Math.min(t.max - t.min, 2) : 2;
|
|
259
|
+
f[e] = l(f[e] + Math.sin((e + 1) * 2.399963229728653 + d * 1.618033988749895) * n * .5, t);
|
|
260
|
+
}
|
|
261
|
+
let p = this.residual(f, t), m = r.damping;
|
|
262
|
+
for (let n = 0; n < r.iterations && (e.signal?.throwIfAborted(), (p.resolved || p.objective < a.objective) && (a = p, i = [...f]), !p.resolved && this.variables.length); n++) {
|
|
263
|
+
s++;
|
|
264
|
+
let e = this.variables.map((e) => {
|
|
265
|
+
let n = Math.min(.001, 1e-6 * Math.max(1, Math.abs(f[e]))), r = [...f], i = [...f];
|
|
266
|
+
r[e] += n, i[e] -= n;
|
|
267
|
+
let a = this.residual(r, t, p).residual, o = this.residual(i, t, p).residual;
|
|
268
|
+
return Float64Array.from(a, (e, t) => (e - o[t]) / (2 * n));
|
|
269
|
+
}), c = !1, d = !1;
|
|
270
|
+
for (let n = 0; n < 10; n++) {
|
|
271
|
+
let n = /* @__PURE__ */ new Set(), s = [];
|
|
272
|
+
for (let t = 0; t <= this.variables.length; t++) {
|
|
273
|
+
s = o(e, p.residual, m, n);
|
|
274
|
+
let t = !1;
|
|
275
|
+
if (this.variables.forEach((e, r) => {
|
|
276
|
+
let i = this.joints[e];
|
|
277
|
+
!n.has(r) && (f[e] <= i.min && s[r] < 0 || f[e] >= i.max && s[r] > 0) && (n.add(r), t = !0);
|
|
278
|
+
}), !t) break;
|
|
279
|
+
}
|
|
280
|
+
let u = Math.max(0, ...s.map(Math.abs)), h = u > r.maxStep ? r.maxStep / u : 1, g = [...f];
|
|
281
|
+
if (this.variables.forEach((e, t) => {
|
|
282
|
+
g[e] = l(f[e] + s[t] * h, this.joints[e]);
|
|
283
|
+
}), g.every((e, t) => Math.abs(e - f[t]) <= 1e-12)) {
|
|
284
|
+
d = !0;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
let _ = this.residual(g, t);
|
|
288
|
+
if (_.objective < p.objective || _.resolved) {
|
|
289
|
+
f = g, p = _, m = Math.max(1e-6, m * .5), c = !0, (p.resolved || p.objective < a.objective) && (a = p, i = [...f]);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
m = Math.min(1e6, m * 4);
|
|
293
|
+
}
|
|
294
|
+
if (!c || d || p.resolved) break;
|
|
295
|
+
n === r.iterations - 1 && (u = !0);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
let d = e.goals?.length ?? 0;
|
|
299
|
+
return {
|
|
300
|
+
resolved: a.resolved,
|
|
301
|
+
status: a.resolved ? "converged" : u ? "iteration-limit" : "stalled",
|
|
302
|
+
values: i,
|
|
303
|
+
poses: a.poses,
|
|
304
|
+
goals: a.errors.slice(0, d),
|
|
305
|
+
loops: a.errors.slice(d),
|
|
306
|
+
objective: a.objective,
|
|
307
|
+
iterations: s,
|
|
308
|
+
candidates: c
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
//#endregion
|
|
313
|
+
export { m as MultiGoalIKSolver };
|
package/dist/sdf.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// @ts-ignore optional peer: its types apply when it is installed
|
|
2
|
+
import type { MeshBVH } from '@margoengine/bvh';
|
|
3
|
+
import { ConvexHullVolume } from './hull.js';
|
|
4
|
+
import type { ConstraintVolume, MutableVec3View, Vec3View } from './types.js';
|
|
5
|
+
/** A field a {@link SDFVolume} can read: `bakeSDF`'s `MeshSDF` is one, and so is any distance function. */
|
|
6
|
+
export interface DistanceField {
|
|
7
|
+
/** Signed distance at a point in the field's own space: negative inside. */
|
|
8
|
+
distance(point: ArrayLike<number>): number;
|
|
9
|
+
/** Corner of a sampled grid. With `max` and `spacing`, the field is read as a trilinear grid. */
|
|
10
|
+
min?: ArrayLike<number>;
|
|
11
|
+
max?: ArrayLike<number>;
|
|
12
|
+
/** World distance between samples, per axis. */
|
|
13
|
+
spacing?: ArrayLike<number>;
|
|
14
|
+
}
|
|
15
|
+
/** Options of {@link SDFVolume}. */
|
|
16
|
+
export interface SDFVolumeOptions {
|
|
17
|
+
field: DistanceField;
|
|
18
|
+
/** Rotation, uniform scale and translation placing the field. Defaults to the identity. */
|
|
19
|
+
matrix?: ArrayLike<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Subtracted from every reading. A grid's default is one cell's diagonal, the most a trilinear reading can overstate
|
|
22
|
+
* a true distance, so the volume never reads a gap the obstacle does not leave. A function's default is 0.
|
|
23
|
+
*/
|
|
24
|
+
margin?: number;
|
|
25
|
+
/** How close the smallest reading along a shape must be pinned down. Default a quarter of a cell, or 1e-3. */
|
|
26
|
+
precision?: number;
|
|
27
|
+
/** Fastest the field can change per unit of distance. A grid's default is the square root of 3, a function's 1. */
|
|
28
|
+
lipschitz?: number;
|
|
29
|
+
/** Most cells one query opens. A query that runs out still answers with a safe lower bound. Default 4,096. */
|
|
30
|
+
maxCells?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A signed distance field as an obstacle, for concave shapes at a fixed cost per reading: hand it `bakeSDF`'s result,
|
|
34
|
+
* or any `{distance(point)}`. Every query answers a value no higher than the true gap, within the field's own bounds,
|
|
35
|
+
* so a solver and a swept check stay safe. It keeps the field in its own space; move it with {@link setTransform}.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { SDFVolume } from 'margoengine/kinematics-constraints/sdf';
|
|
40
|
+
*
|
|
41
|
+
* // A ring of radius 1 and tube 0.2 about +Z, as a function.
|
|
42
|
+
* const ring = new SDFVolume({
|
|
43
|
+
* field: { distance: ([x, y, z]) => Math.hypot(Math.hypot(x, y) - 1, z) - 0.2 },
|
|
44
|
+
* });
|
|
45
|
+
* const gap = ring.segmentClearance([0, 0, -2], [0, 0, 2], 0.1); // through the hole: 0.7
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class SDFVolume implements ConstraintVolume {
|
|
49
|
+
/** Subtracted from every reading, in world units. */
|
|
50
|
+
readonly margin: number;
|
|
51
|
+
/** How close a shape's smallest reading is pinned down, in world units. */
|
|
52
|
+
readonly precision: number;
|
|
53
|
+
private readonly field;
|
|
54
|
+
private readonly lipschitz;
|
|
55
|
+
private readonly maxCells;
|
|
56
|
+
private readonly placement;
|
|
57
|
+
private readonly grid;
|
|
58
|
+
private readonly local;
|
|
59
|
+
private readonly stack;
|
|
60
|
+
constructor(options: SDFVolumeOptions);
|
|
61
|
+
/** Places the field: a column-major matrix of 16 values holding a rotation, one uniform scale and a move. */
|
|
62
|
+
setTransform(matrix: ArrayLike<number>): this;
|
|
63
|
+
/** The reading at a world point, margin taken off. */
|
|
64
|
+
private read;
|
|
65
|
+
/** Signed distance to the surface as the field sees it, less the margin, with the closest point and outward normal. */
|
|
66
|
+
evaluate(point: Vec3View, outPoint: MutableVec3View, outDirection: MutableVec3View): number;
|
|
67
|
+
/** Lowest reading on a segment, minus `radius`, never above the true value: branch and bound on the Lipschitz bound. */
|
|
68
|
+
segmentClearance(start: Vec3View, end: Vec3View, radius: number): number;
|
|
69
|
+
/** {@link segmentClearance} for a convex hull: branch and bound over cells of the hull's box. Writes to `out[0]`. */
|
|
70
|
+
hullClearanceInto(hull: ConvexHullVolume, out: Float64Array): void;
|
|
71
|
+
}
|
|
72
|
+
/** Options of {@link MeshVolume}. */
|
|
73
|
+
export interface MeshVolumeOptions {
|
|
74
|
+
/** The obstacle's tree. Its triangles stay in the tree's own space. */
|
|
75
|
+
bvh: MeshBVH;
|
|
76
|
+
/** Rotation, uniform scale and translation placing the mesh. Defaults to the identity. */
|
|
77
|
+
matrix?: ArrayLike<number>;
|
|
78
|
+
/**
|
|
79
|
+
* A closed mesh is solid: a point inside reads negative, by winding number. False treats the mesh as a thin sheet, for
|
|
80
|
+
* open surfaces such as a terrain, and reads the plain distance. Default true.
|
|
81
|
+
*/
|
|
82
|
+
solid?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A triangle mesh as an exact obstacle, concave or not: arm links, hulls and points measure against the real surface,
|
|
86
|
+
* through a `MeshBVH`, so a bowl has an inside to reach into and a ring has a hole. Slower per query than a baked
|
|
87
|
+
* {@link SDFVolume}, and exact, with no grid to bound.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { MeshBVH } from 'margoengine/bvh';
|
|
92
|
+
* import { MeshVolume } from 'margoengine/kinematics-constraints/sdf';
|
|
93
|
+
*
|
|
94
|
+
* // One triangle in the plane z = 0; pass your own mesh's positions and indices.
|
|
95
|
+
* const positions = new Float32Array([0, 0, 0, 2, 0, 0, 0, 2, 0]);
|
|
96
|
+
* const bvh = MeshBVH.build({ positions, indices: new Uint32Array([0, 1, 2]) });
|
|
97
|
+
* const sheet = new MeshVolume({ bvh, solid: false });
|
|
98
|
+
* const gap = sheet.segmentClearance([0.5, 0.5, 1], [0.5, 0.5, 2], 0.25); // 0.75
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare class MeshVolume implements ConstraintVolume {
|
|
102
|
+
private readonly bvh;
|
|
103
|
+
private readonly solid;
|
|
104
|
+
private readonly placement;
|
|
105
|
+
private readonly triangle;
|
|
106
|
+
private readonly world;
|
|
107
|
+
private readonly local;
|
|
108
|
+
private readonly queryMin;
|
|
109
|
+
private readonly queryMax;
|
|
110
|
+
private readonly gap;
|
|
111
|
+
constructor(options: MeshVolumeOptions);
|
|
112
|
+
/** Places the mesh: a column-major matrix of 16 values holding a rotation, one uniform scale and a move. */
|
|
113
|
+
setTransform(matrix: ArrayLike<number>): this;
|
|
114
|
+
private inside;
|
|
115
|
+
/** Signed distance to the surface, negative inside a solid mesh, with the closest point and the outward normal. */
|
|
116
|
+
evaluate(point: Vec3View, outPoint: MutableVec3View, outDirection: MutableVec3View): number;
|
|
117
|
+
/** Signed gap to a capsule round a segment. A segment that crosses the surface reads minus its radius. */
|
|
118
|
+
segmentClearance(start: Vec3View, end: Vec3View, radius: number): number;
|
|
119
|
+
/** Signed gap to a convex hull at its current transform, written to `out[0]`. */
|
|
120
|
+
hullClearanceInto(hull: ConvexHullVolume, out: Float64Array): void;
|
|
121
|
+
}
|
package/dist/sdf.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { n as e, r as t } from "./errors-D5_2oB8I.js";
|
|
2
|
+
import { t as n } from "./validate-vector-7JTvvTtJ.js";
|
|
3
|
+
import { a as r, n as i, r as a, t as o } from "./hull-RrgFbmB9.js";
|
|
4
|
+
import { pointInside as s } from "@margoengine/bvh/inside";
|
|
5
|
+
//#region src/sdf.ts
|
|
6
|
+
var c = /* @__PURE__ */ Object.freeze([
|
|
7
|
+
1,
|
|
8
|
+
0,
|
|
9
|
+
0,
|
|
10
|
+
0,
|
|
11
|
+
0,
|
|
12
|
+
1,
|
|
13
|
+
0,
|
|
14
|
+
0,
|
|
15
|
+
0,
|
|
16
|
+
0,
|
|
17
|
+
1,
|
|
18
|
+
0,
|
|
19
|
+
0,
|
|
20
|
+
0,
|
|
21
|
+
0,
|
|
22
|
+
1
|
|
23
|
+
]), l = class {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.forward = /* @__PURE__ */ new Float64Array(12), this.inverse = /* @__PURE__ */ new Float64Array(12), this.scale = 1;
|
|
26
|
+
}
|
|
27
|
+
set(n) {
|
|
28
|
+
if (!n || n.length !== 16) throw t("A volume matrix must have 16 values", "kinematics");
|
|
29
|
+
for (let t = 0; t < 16; t++) if (!Number.isFinite(n[t])) throw e("A volume matrix must be finite", "kinematics");
|
|
30
|
+
if (n[3] !== 0 || n[7] !== 0 || n[11] !== 0 || n[15] !== 1) throw e("A volume matrix must be affine; its last row must be 0, 0, 0, 1", "kinematics");
|
|
31
|
+
let r = this.forward;
|
|
32
|
+
for (let e = 0; e < 4; e++) for (let t = 0; t < 3; t++) r[e * 3 + t] = n[e * 4 + t];
|
|
33
|
+
let i = Math.hypot(r[0], r[1], r[2]), a = Math.hypot(r[3], r[4], r[5]), o = Math.hypot(r[6], r[7], r[8]), s = Math.abs(r[0] * r[3] + r[1] * r[4] + r[2] * r[5]) + Math.abs(r[0] * r[6] + r[1] * r[7] + r[2] * r[8]) + Math.abs(r[3] * r[6] + r[4] * r[7] + r[5] * r[8]), c = r[0] * (r[4] * r[8] - r[5] * r[7]) + r[1] * (r[5] * r[6] - r[3] * r[8]) + r[2] * (r[3] * r[7] - r[4] * r[6]);
|
|
34
|
+
if (!(i > 0) || Math.abs(a - i) > 1e-6 * i || Math.abs(o - i) > 1e-6 * i || s > 1e-6 * i * i || c < 0) throw e("A volume matrix must be a rotation, one uniform scale and a move: distances must survive it", "kinematics");
|
|
35
|
+
this.scale = i;
|
|
36
|
+
let l = this.inverse, u = 1 / (i * i);
|
|
37
|
+
for (let e = 0; e < 3; e++) for (let t = 0; t < 3; t++) l[e * 3 + t] = r[t * 3 + e] * u;
|
|
38
|
+
for (let e = 0; e < 3; e++) l[9 + e] = -(l[e] * r[9] + l[3 + e] * r[10] + l[6 + e] * r[11]);
|
|
39
|
+
}
|
|
40
|
+
toLocal(e, t, n, r, i) {
|
|
41
|
+
let a = this.inverse;
|
|
42
|
+
r[i] = a[0] * e + a[3] * t + a[6] * n + a[9], r[i + 1] = a[1] * e + a[4] * t + a[7] * n + a[10], r[i + 2] = a[2] * e + a[5] * t + a[8] * n + a[11];
|
|
43
|
+
}
|
|
44
|
+
toWorld(e, t, n, r, i) {
|
|
45
|
+
let a = this.forward;
|
|
46
|
+
r[i] = a[0] * e + a[3] * t + a[6] * n + a[9], r[i + 1] = a[1] * e + a[4] * t + a[7] * n + a[10], r[i + 2] = a[2] * e + a[5] * t + a[8] * n + a[11];
|
|
47
|
+
}
|
|
48
|
+
}, u = /* @__PURE__ */ new Float64Array(3), d = /* @__PURE__ */ new Float64Array(3), f = /* @__PURE__ */ new Float64Array(1);
|
|
49
|
+
function p(e, t, n, r) {
|
|
50
|
+
let i = Math.hypot(e, t, n);
|
|
51
|
+
i > 0 ? (r[0] = e / i, r[1] = t / i, r[2] = n / i) : (r[0] = 1, r[1] = 0, r[2] = 0);
|
|
52
|
+
}
|
|
53
|
+
var m = class {
|
|
54
|
+
constructor(n) {
|
|
55
|
+
this.placement = new l(), this.local = /* @__PURE__ */ new Float64Array(3), this.stack = [];
|
|
56
|
+
let r = n?.field;
|
|
57
|
+
if (!r || typeof r.distance != "function") throw t("SDFVolume needs a field with a distance(point) method, such as bakeSDF gives", "kinematics");
|
|
58
|
+
this.field = r, this.grid = !!(r.min && r.max && r.spacing);
|
|
59
|
+
let i = r.spacing;
|
|
60
|
+
this.placement.set(n.matrix ?? c);
|
|
61
|
+
let a = this.placement.scale, o = i ? Math.hypot(i[0], i[1], i[2]) * a : 0, s = i ? Math.min(i[0], i[1], i[2]) * a : 0;
|
|
62
|
+
if (this.margin = n.margin ?? (this.grid ? o : 0), this.precision = n.precision ?? (this.grid ? s / 4 : .001), this.lipschitz = n.lipschitz ?? (this.grid ? Math.sqrt(3) : 1), this.maxCells = n.maxCells ?? 4096, !(this.margin >= 0) || !Number.isFinite(this.margin)) throw e("SDFVolume margin must be 0 or more", "kinematics");
|
|
63
|
+
if (!(this.precision > 0) || !Number.isFinite(this.precision)) throw e("SDFVolume precision must be above 0", "kinematics");
|
|
64
|
+
if (!(this.lipschitz > 0) || !Number.isFinite(this.lipschitz)) throw e("SDFVolume lipschitz must be above 0", "kinematics");
|
|
65
|
+
if (!Number.isSafeInteger(this.maxCells) || this.maxCells < 1) throw e("SDFVolume maxCells must be a positive integer", "kinematics");
|
|
66
|
+
}
|
|
67
|
+
setTransform(e) {
|
|
68
|
+
return this.placement.set(e), this;
|
|
69
|
+
}
|
|
70
|
+
read(t, n, r) {
|
|
71
|
+
let { placement: i, local: a, field: o } = this;
|
|
72
|
+
i.toLocal(t, n, r, a, 0);
|
|
73
|
+
let s;
|
|
74
|
+
if (this.grid) {
|
|
75
|
+
let e = o.min, t = o.max, n = 0;
|
|
76
|
+
for (let r = 0; r < 3; r++) {
|
|
77
|
+
let i = Math.min(Math.max(a[r], e[r]), t[r]);
|
|
78
|
+
n += (a[r] - i) ** 2, a[r] = i;
|
|
79
|
+
}
|
|
80
|
+
n = Math.sqrt(n);
|
|
81
|
+
let r = o.distance(a);
|
|
82
|
+
s = n > 0 ? Math.max(n, r - n) : r;
|
|
83
|
+
} else s = o.distance(a);
|
|
84
|
+
if (!Number.isFinite(s)) throw e("A distance field gave no finite distance", "kinematics");
|
|
85
|
+
return s * i.scale - this.margin;
|
|
86
|
+
}
|
|
87
|
+
evaluate(e, t, r) {
|
|
88
|
+
n(e, "query point");
|
|
89
|
+
let i = e[0], a = e[1], o = e[2], s = this.precision, c = this.read(i, a, o);
|
|
90
|
+
return p(this.read(i + s, a, o) - this.read(i - s, a, o), this.read(i, a + s, o) - this.read(i, a - s, o), this.read(i, a, o + s) - this.read(i, a, o - s), r), t[0] = i - r[0] * c, t[1] = a - r[1] * c, t[2] = o - r[2] * c, c;
|
|
91
|
+
}
|
|
92
|
+
segmentClearance(t, r, i) {
|
|
93
|
+
if (n(t, "segment start"), n(r, "segment end"), !(i >= 0) || !Number.isFinite(i)) throw e("Segment radius must be 0 or more", "kinematics");
|
|
94
|
+
let a = t[0], o = t[1], s = t[2], c = r[0] - a, l = r[1] - o, u = r[2] - s, d = this.lipschitz * Math.hypot(c, l, u), f = this.precision, p = this.stack, m = Math.min(this.read(a, o, s), this.read(a + c, o + l, s + u)), h = Infinity, g = 0;
|
|
95
|
+
for (p.length = 0, p.push(0, 1); p.length;) {
|
|
96
|
+
let e = p.pop(), t = p.pop(), n = (t + e) / 2, r = this.read(a + c * n, o + l * n, s + u * n), i = r - d * (e - t) / 2;
|
|
97
|
+
r < m && (m = r), !(i >= m - f) && (++g >= this.maxCells ? i < h && (h = i) : p.push(t, n, n, e));
|
|
98
|
+
}
|
|
99
|
+
return Math.min(m - f, h) - i;
|
|
100
|
+
}
|
|
101
|
+
hullClearanceInto(e, t) {
|
|
102
|
+
let n = /* @__PURE__ */ new Float64Array(6);
|
|
103
|
+
i(e, n);
|
|
104
|
+
let r = this.precision, a = this.lipschitz, o = this.stack, s = Infinity, c = Infinity, l = 0;
|
|
105
|
+
for (o.length = 0, o.push((n[0] + n[3]) / 2, (n[1] + n[4]) / 2, (n[2] + n[5]) / 2, Math.max(n[3] - n[0], n[4] - n[1], n[5] - n[2]) / 2); o.length;) {
|
|
106
|
+
let t = o.pop(), n = o.pop(), i = o.pop(), p = o.pop(), m = t * Math.sqrt(3), h = Float64Array.of(p, i, n);
|
|
107
|
+
if (e.evaluateInto(h, u, d, f), f[0] > m) continue;
|
|
108
|
+
let g = f[0] > 0, _ = g ? this.read(u[0], u[1], u[2]) : this.read(p, i, n);
|
|
109
|
+
_ < s && (s = _);
|
|
110
|
+
let v = (g ? this.read(p, i, n) : _) - a * m;
|
|
111
|
+
if (v >= s - r) continue;
|
|
112
|
+
if (++l >= this.maxCells) {
|
|
113
|
+
v < c && (c = v);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let y = t / 2;
|
|
117
|
+
for (let e = 0; e < 8; e++) o.push(p + (e & 1 ? y : -y), i + (e & 2 ? y : -y), n + (e & 4 ? y : -y), y);
|
|
118
|
+
}
|
|
119
|
+
t[0] = Math.min(s - r, c);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function h(e, t, n, r) {
|
|
123
|
+
let i = 0;
|
|
124
|
+
for (let a = 0; a < 3; a++) {
|
|
125
|
+
let o = Math.max(e[a] - r[a], n[a] - t[a], 0);
|
|
126
|
+
i += o * o;
|
|
127
|
+
}
|
|
128
|
+
return i;
|
|
129
|
+
}
|
|
130
|
+
var g = class {
|
|
131
|
+
constructor(e) {
|
|
132
|
+
this.placement = new l(), this.triangle = new o({ points: [
|
|
133
|
+
0,
|
|
134
|
+
0,
|
|
135
|
+
0,
|
|
136
|
+
1,
|
|
137
|
+
0,
|
|
138
|
+
0,
|
|
139
|
+
0,
|
|
140
|
+
1,
|
|
141
|
+
0
|
|
142
|
+
] }), this.world = /* @__PURE__ */ new Float64Array(9), this.local = /* @__PURE__ */ new Float64Array(6), this.queryMin = /* @__PURE__ */ new Float64Array(3), this.queryMax = /* @__PURE__ */ new Float64Array(3), this.gap = /* @__PURE__ */ new Float64Array(1);
|
|
143
|
+
let n = e?.bvh;
|
|
144
|
+
if (!n || typeof n.shapecast != "function") throw t("MeshVolume needs a MeshBVH", "kinematics");
|
|
145
|
+
this.bvh = n, this.solid = e.solid !== !1, this.placement.set(e.matrix ?? c);
|
|
146
|
+
}
|
|
147
|
+
setTransform(e) {
|
|
148
|
+
return this.placement.set(e), this;
|
|
149
|
+
}
|
|
150
|
+
inside(e) {
|
|
151
|
+
return this.solid && s(this.bvh, e);
|
|
152
|
+
}
|
|
153
|
+
evaluate(t, r, i) {
|
|
154
|
+
n(t, "query point");
|
|
155
|
+
let { placement: a, bvh: o, local: s, world: c } = this;
|
|
156
|
+
a.toLocal(t[0], t[1], t[2], s, 0);
|
|
157
|
+
let l = o.closestPointToPoint(s);
|
|
158
|
+
if (!l) throw e("MeshVolume has no triangles", "kinematics");
|
|
159
|
+
let u = this.inside(s);
|
|
160
|
+
a.toWorld(l.point[0], l.point[1], l.point[2], c, 0);
|
|
161
|
+
let d = l.distance * a.scale, f = t[0] - c[0], m = t[1] - c[1], h = t[2] - c[2];
|
|
162
|
+
if (r[0] = c[0], r[1] = c[1], r[2] = c[2], d > 1e-12) p(u ? -f : f, u ? -m : m, u ? -h : h, i);
|
|
163
|
+
else {
|
|
164
|
+
let { positions: e, stride: t, index: n, triangles: r } = o, s = r.indexOf(l.faceIndex) * 3;
|
|
165
|
+
for (let r = 0; r < 3; r++) {
|
|
166
|
+
let i = n[s + r] * t;
|
|
167
|
+
a.toWorld(e[i], e[i + 1], e[i + 2], c, r * 3);
|
|
168
|
+
}
|
|
169
|
+
for (let e = 0; e < 3; e++) c[3 + e] -= c[e], c[6 + e] -= c[e];
|
|
170
|
+
p(c[4] * c[8] - c[5] * c[7], c[5] * c[6] - c[3] * c[8], c[3] * c[7] - c[4] * c[6], i);
|
|
171
|
+
}
|
|
172
|
+
return u ? -d : d;
|
|
173
|
+
}
|
|
174
|
+
segmentClearance(t, i, a) {
|
|
175
|
+
if (n(t, "segment start"), n(i, "segment end"), !(a >= 0) || !Number.isFinite(a)) throw e("Segment radius must be 0 or more", "kinematics");
|
|
176
|
+
let { placement: o, local: s, queryMin: c, queryMax: l, triangle: u, gap: d } = this;
|
|
177
|
+
o.toLocal(t[0], t[1], t[2], s, 0), o.toLocal(i[0], i[1], i[2], s, 3);
|
|
178
|
+
for (let e = 0; e < 3; e++) c[e] = Math.min(s[e], s[3 + e]), l[e] = Math.max(s[e], s[3 + e]);
|
|
179
|
+
let f = s.subarray(0, 3), p = s.subarray(3, 6), m = Infinity, g = (e) => Math.sqrt(h(e.min, e.max, c, l));
|
|
180
|
+
return this.bvh.shapecast({
|
|
181
|
+
boundsTraverseOrder: g,
|
|
182
|
+
intersectsBounds: (e, t, n) => (n ?? g(e)) < m,
|
|
183
|
+
intersectsTriangle: (e) => (r(u, e.a, e.b, e.c), u.segmentClearanceInto(f, p, 0, d), d[0] < m && (m = d[0]), m <= 0)
|
|
184
|
+
}), m > 0 ? this.inside(f) ? -m * o.scale - a : m * o.scale - a : -a;
|
|
185
|
+
}
|
|
186
|
+
hullClearanceInto(e, t) {
|
|
187
|
+
let { placement: n, local: o, queryMin: s, queryMax: c, triangle: l, gap: u, world: d } = this, f = /* @__PURE__ */ new Float64Array(6);
|
|
188
|
+
i(e, f), s.fill(Infinity), c.fill(-Infinity);
|
|
189
|
+
for (let e = 0; e < 8; e++) {
|
|
190
|
+
n.toLocal(f[e & 1 ? 3 : 0], f[e & 2 ? 4 : 1], f[e & 4 ? 5 : 2], o, 0);
|
|
191
|
+
for (let e = 0; e < 3; e++) s[e] = Math.min(s[e], o[e]), c[e] = Math.max(c[e], o[e]);
|
|
192
|
+
}
|
|
193
|
+
let p = n.scale, m = Infinity, g = (e) => Math.sqrt(h(e.min, e.max, s, c)) * p;
|
|
194
|
+
this.bvh.shapecast({
|
|
195
|
+
boundsTraverseOrder: g,
|
|
196
|
+
intersectsBounds: (e, t, n) => (n ?? g(e)) < m,
|
|
197
|
+
intersectsTriangle: (t) => (n.toWorld(t.a[0], t.a[1], t.a[2], d, 0), n.toWorld(t.b[0], t.b[1], t.b[2], d, 3), n.toWorld(t.c[0], t.c[1], t.c[2], d, 6), r(l, d.subarray(0, 3), d.subarray(3, 6), d.subarray(6, 9)), l.hullClearanceInto(e, u), u[0] < m && (m = u[0]), m <= 0)
|
|
198
|
+
}), m > 0 && this.solid && (a(e, o), n.toLocal(o[0], o[1], o[2], o, 3), this.inside(o.subarray(3, 6)) && (m = -m)), t[0] = m;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
202
|
+
export { g as MeshVolume, m as SDFVolume };
|