brepjs 18.113.0 → 18.115.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/adjacencyFns-BYnyXXqt.js +247 -0
- package/dist/adjacencyFns-d8ZabkvX.cjs +294 -0
- package/dist/brepjs.cjs +31 -406
- package/dist/brepjs.js +7 -390
- package/dist/{healingFns-D00TPE9p.js → healingFns-2TJHHDg5.js} +3 -246
- package/dist/{healingFns-x1sHV-HO.cjs → healingFns-xLJ6Cp_O.cjs} +0 -291
- package/dist/index.d.ts +2 -2
- package/dist/refResolveFns-hEOEcFZ8.js +761 -0
- package/dist/refResolveFns-pRVyjy35.cjs +880 -0
- package/dist/shapeRef.cjs +21 -7
- package/dist/shapeRef.d.ts +10 -2
- package/dist/shapeRef.js +2 -2
- package/dist/topology/shapeRef/index.d.ts +1 -0
- package/dist/topology/shapeRef/refResolveFns.d.ts +53 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts +9 -7
- package/dist/topology.cjs +8 -7
- package/dist/topology.js +2 -1
- package/package.json +1 -1
- package/dist/shapeRefFns-ChMnsOAF.js +0 -248
- package/dist/shapeRefFns-CuepnFOm.cjs +0 -283
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as getKernel, _ as isSolid, h as isShape3D, p as isFace,
|
|
1
|
+
import { Z as getKernel, _ as isSolid, h as isShape3D, p as isFace, t as castShape, y as isWire } from "./shapeTypes-Dpu6mD3m.js";
|
|
2
2
|
import { A as ok, T as isOk, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { c as getFaces, i as getCachedIsValid,
|
|
3
|
+
import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-BeKaWpNm.js";
|
|
4
4
|
import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
|
|
5
5
|
import { v as downcast } from "./faceFns-B86WGqDg.js";
|
|
6
6
|
import { g as collectInputFaceHashes, v as propagateAllMetadata } from "./shapeFns-DrZOVwHX.js";
|
|
@@ -155,249 +155,6 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
155
155
|
return ok(wrapped);
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
|
-
//#region src/topology/adjacencyFns.ts
|
|
159
|
-
/**
|
|
160
|
-
* Topology adjacency queries — find related sub-shapes within a parent shape.
|
|
161
|
-
*
|
|
162
|
-
* Uses cached topology extraction and an edge→faces adjacency map
|
|
163
|
-
* (built once per parent shape and cached) to avoid redundant WASM calls.
|
|
164
|
-
*/
|
|
165
|
-
function wrapAll(shapes, type) {
|
|
166
|
-
return shapes.map((s) => castShapeWithKnownType(s, type));
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Iterate sub-shapes of `parentKernel` of the given `type`, deduplicate by
|
|
170
|
-
* hash+isSame, and return branded handles of type `T`.
|
|
171
|
-
*
|
|
172
|
-
* Used by edgesOfFace, wiresOfFace, and verticesOfEdge — all of which need
|
|
173
|
-
* the same deduplicated-children pattern on a raw KernelShape.
|
|
174
|
-
*/
|
|
175
|
-
function deduplicatedSubShapes(parentKernel, type) {
|
|
176
|
-
const kernel = getKernel();
|
|
177
|
-
const items = kernel.iterShapes(parentKernel, type);
|
|
178
|
-
const results = [];
|
|
179
|
-
const seen = /* @__PURE__ */ new Map();
|
|
180
|
-
for (const item of items) {
|
|
181
|
-
const hash = kernel.hashCode(item, HASH_CODE_MAX);
|
|
182
|
-
const bucket = seen.get(hash);
|
|
183
|
-
if (!bucket) {
|
|
184
|
-
seen.set(hash, [item]);
|
|
185
|
-
results.push(item);
|
|
186
|
-
} else if (!bucket.some((r) => kernel.isSame(r, item))) {
|
|
187
|
-
bucket.push(item);
|
|
188
|
-
results.push(item);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return wrapAll(results, type);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Build or retrieve the cached edge→faces adjacency map for a parent shape.
|
|
195
|
-
* Maps edge hash codes to edge-face pairs, storing the edge alongside each
|
|
196
|
-
* face so facesOfEdge can verify via isSame without re-extracting face edges.
|
|
197
|
-
*/
|
|
198
|
-
function getEdgeToFacesMap(parent) {
|
|
199
|
-
const cache = getOrCreateCache(parent);
|
|
200
|
-
if (cache.edgeToFaces) return cache.edgeToFaces;
|
|
201
|
-
const kernel = getKernel();
|
|
202
|
-
const edgeToFaces = /* @__PURE__ */ new Map();
|
|
203
|
-
const allFaces = kernel.iterShapes(parent.wrapped, "face");
|
|
204
|
-
for (const f of allFaces) {
|
|
205
|
-
const edges = kernel.iterShapes(f, "edge");
|
|
206
|
-
for (const e of edges) {
|
|
207
|
-
const hash = kernel.hashCode(e, HASH_CODE_MAX);
|
|
208
|
-
let bucket = edgeToFaces.get(hash);
|
|
209
|
-
if (!bucket) {
|
|
210
|
-
bucket = [];
|
|
211
|
-
edgeToFaces.set(hash, bucket);
|
|
212
|
-
}
|
|
213
|
-
if (!bucket.some((entry) => kernel.isSame(entry.edge, e) && kernel.isSame(entry.face, f))) bucket.push({
|
|
214
|
-
edge: e,
|
|
215
|
-
face: f
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
cache.edgeToFaces = edgeToFaces;
|
|
220
|
-
return edgeToFaces;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Build or retrieve the cached vertex→faces adjacency map for a parent shape —
|
|
224
|
-
* the vertex analogue of {@link getEdgeToFacesMap}.
|
|
225
|
-
*/
|
|
226
|
-
function getVertexToFacesMap(parent) {
|
|
227
|
-
const cache = getOrCreateCache(parent);
|
|
228
|
-
if (cache.vertexToFaces) return cache.vertexToFaces;
|
|
229
|
-
const kernel = getKernel();
|
|
230
|
-
const vertexToFaces = /* @__PURE__ */ new Map();
|
|
231
|
-
for (const f of kernel.iterShapes(parent.wrapped, "face")) for (const v of kernel.iterShapes(f, "vertex")) {
|
|
232
|
-
const hash = kernel.hashCode(v, HASH_CODE_MAX);
|
|
233
|
-
let bucket = vertexToFaces.get(hash);
|
|
234
|
-
if (!bucket) {
|
|
235
|
-
bucket = [];
|
|
236
|
-
vertexToFaces.set(hash, bucket);
|
|
237
|
-
}
|
|
238
|
-
if (!bucket.some((entry) => kernel.isSame(entry.vertex, v) && kernel.isSame(entry.face, f))) bucket.push({
|
|
239
|
-
vertex: v,
|
|
240
|
-
face: f
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
cache.vertexToFaces = vertexToFaces;
|
|
244
|
-
return vertexToFaces;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Get all faces adjacent to a given edge within a parent shape.
|
|
248
|
-
*
|
|
249
|
-
* An edge typically borders exactly two faces in a solid, or one face
|
|
250
|
-
* if the edge is on a boundary.
|
|
251
|
-
*
|
|
252
|
-
* @param parent - The parent shape to search within.
|
|
253
|
-
* @param edge - The edge whose adjacent faces to find.
|
|
254
|
-
* @returns Array of unique faces containing the given edge.
|
|
255
|
-
*/
|
|
256
|
-
function facesOfEdge(parent, edge) {
|
|
257
|
-
const kernel = getKernel();
|
|
258
|
-
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
259
|
-
const hash = kernel.hashCode(edge.wrapped, HASH_CODE_MAX);
|
|
260
|
-
const bucket = edgeToFaces.get(hash) ?? [];
|
|
261
|
-
const results = [];
|
|
262
|
-
const seen = /* @__PURE__ */ new Map();
|
|
263
|
-
for (const entry of bucket) {
|
|
264
|
-
if (!kernel.isSame(entry.edge, edge.wrapped)) continue;
|
|
265
|
-
const fHash = kernel.hashCode(entry.face, HASH_CODE_MAX);
|
|
266
|
-
const fBucket = seen.get(fHash);
|
|
267
|
-
if (!fBucket) {
|
|
268
|
-
seen.set(fHash, [entry.face]);
|
|
269
|
-
results.push(entry.face);
|
|
270
|
-
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
271
|
-
fBucket.push(entry.face);
|
|
272
|
-
results.push(entry.face);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return wrapAll(results, "face");
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get all faces meeting at a vertex (≥3 for a solid corner, fewer on a
|
|
279
|
-
* boundary), via the cached vertex→faces map. The vertex equivalent of
|
|
280
|
-
* {@link facesOfEdge}, with the same hash-bucket + isSame verification.
|
|
281
|
-
*
|
|
282
|
-
* @param parent - The parent shape to search within.
|
|
283
|
-
* @param vertex - The vertex whose adjacent faces to find.
|
|
284
|
-
*/
|
|
285
|
-
function facesOfVertex(parent, vertex) {
|
|
286
|
-
const kernel = getKernel();
|
|
287
|
-
const vertexToFaces = getVertexToFacesMap(parent);
|
|
288
|
-
const hash = kernel.hashCode(vertex.wrapped, HASH_CODE_MAX);
|
|
289
|
-
const bucket = vertexToFaces.get(hash) ?? [];
|
|
290
|
-
const results = [];
|
|
291
|
-
const seen = /* @__PURE__ */ new Map();
|
|
292
|
-
for (const entry of bucket) {
|
|
293
|
-
if (!kernel.isSame(entry.vertex, vertex.wrapped)) continue;
|
|
294
|
-
const fHash = kernel.hashCode(entry.face, HASH_CODE_MAX);
|
|
295
|
-
const fBucket = seen.get(fHash);
|
|
296
|
-
if (!fBucket) {
|
|
297
|
-
seen.set(fHash, [entry.face]);
|
|
298
|
-
results.push(entry.face);
|
|
299
|
-
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
300
|
-
fBucket.push(entry.face);
|
|
301
|
-
results.push(entry.face);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return wrapAll(results, "face");
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Get all edges bounding a face.
|
|
308
|
-
*
|
|
309
|
-
* @param face - The face whose edges to enumerate.
|
|
310
|
-
* @returns Array of unique edges forming the face boundary.
|
|
311
|
-
*/
|
|
312
|
-
function edgesOfFace(face) {
|
|
313
|
-
return deduplicatedSubShapes(face.wrapped, "edge");
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Get all vertices of a face. The vertex equivalent of {@link edgesOfFace}.
|
|
317
|
-
*
|
|
318
|
-
* @param face - The face whose vertices to enumerate.
|
|
319
|
-
*/
|
|
320
|
-
function verticesOfFace(face) {
|
|
321
|
-
return deduplicatedSubShapes(face.wrapped, "vertex");
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Get all wires of a face (outer wire + inner hole wires).
|
|
325
|
-
* All wires bounding a face are closed by definition.
|
|
326
|
-
*
|
|
327
|
-
* @param face - The face whose wires to enumerate.
|
|
328
|
-
*/
|
|
329
|
-
function wiresOfFace(face) {
|
|
330
|
-
return deduplicatedSubShapes(face.wrapped, "wire");
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Get the start and end vertices of an edge.
|
|
334
|
-
*
|
|
335
|
-
* @param edge - The edge whose vertices to retrieve.
|
|
336
|
-
* @returns Array of 1-2 vertices (1 if degenerate/closed, 2 otherwise).
|
|
337
|
-
*/
|
|
338
|
-
function verticesOfEdge(edge) {
|
|
339
|
-
return deduplicatedSubShapes(edge.wrapped, "vertex");
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Get all faces that share at least one edge with the given face.
|
|
343
|
-
*
|
|
344
|
-
* The returned list does not include the input face itself.
|
|
345
|
-
* Uses the cached edge→faces adjacency map for the parent shape.
|
|
346
|
-
*
|
|
347
|
-
* @param parent - The parent shape to search within.
|
|
348
|
-
* @param face - The face whose neighbors to find.
|
|
349
|
-
* @returns Array of unique adjacent faces (excluding the input face).
|
|
350
|
-
*/
|
|
351
|
-
function adjacentFaces(parent, face) {
|
|
352
|
-
const kernel = getKernel();
|
|
353
|
-
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
354
|
-
const faceEdgeHandles = deduplicatedSubShapes(face.wrapped, "edge");
|
|
355
|
-
const neighborRaw = [];
|
|
356
|
-
const seen = /* @__PURE__ */ new Map();
|
|
357
|
-
for (const edgeHandle of faceEdgeHandles) {
|
|
358
|
-
const hash = kernel.hashCode(edgeHandle.wrapped, HASH_CODE_MAX);
|
|
359
|
-
const entries = edgeToFaces.get(hash) ?? [];
|
|
360
|
-
for (const entry of entries) {
|
|
361
|
-
if (kernel.isSame(entry.face, face.wrapped)) continue;
|
|
362
|
-
const fHash = kernel.hashCode(entry.face, HASH_CODE_MAX);
|
|
363
|
-
const bucket = seen.get(fHash);
|
|
364
|
-
if (!bucket) {
|
|
365
|
-
seen.set(fHash, [entry.face]);
|
|
366
|
-
neighborRaw.push(entry.face);
|
|
367
|
-
} else if (!bucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
368
|
-
bucket.push(entry.face);
|
|
369
|
-
neighborRaw.push(entry.face);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return wrapAll(neighborRaw, "face");
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Get all edges shared between two faces.
|
|
377
|
-
*
|
|
378
|
-
* @param face1 - The first face.
|
|
379
|
-
* @param face2 - The second face.
|
|
380
|
-
* @returns Array of edges present in both faces (via isSame comparison).
|
|
381
|
-
*/
|
|
382
|
-
function sharedEdges(face1, face2) {
|
|
383
|
-
const kernel = getKernel();
|
|
384
|
-
const edges1 = kernel.iterShapes(face1.wrapped, "edge");
|
|
385
|
-
const edges2 = kernel.iterShapes(face2.wrapped, "edge");
|
|
386
|
-
const edge2Map = /* @__PURE__ */ new Map();
|
|
387
|
-
for (const e2 of edges2) {
|
|
388
|
-
const hash = kernel.hashCode(e2, HASH_CODE_MAX);
|
|
389
|
-
let bucket = edge2Map.get(hash);
|
|
390
|
-
if (!bucket) {
|
|
391
|
-
bucket = [];
|
|
392
|
-
edge2Map.set(hash, bucket);
|
|
393
|
-
}
|
|
394
|
-
bucket.push(e2);
|
|
395
|
-
}
|
|
396
|
-
const shared = [];
|
|
397
|
-
for (const e1 of edges1) if (edge2Map.get(kernel.hashCode(e1, 2147483647))?.some((e2) => kernel.isSame(e1, e2))) shared.push(e1);
|
|
398
|
-
return wrapAll(shared, "edge");
|
|
399
|
-
}
|
|
400
|
-
//#endregion
|
|
401
158
|
//#region src/topology/nurbsFns.ts
|
|
402
159
|
/**
|
|
403
160
|
* Extract NURBS data from a BSpline or Bezier edge.
|
|
@@ -1437,4 +1194,4 @@ function fixSelfIntersection(wire) {
|
|
|
1437
1194
|
}
|
|
1438
1195
|
}
|
|
1439
1196
|
//#endregion
|
|
1440
|
-
export {
|
|
1197
|
+
export { toBufferGeometryData as A, shellWithEvolution as C, getNurbsCurveData as D, fuseAllBisect as E, toLODGeometryData as M, toLODGeometryLevels as N, getNurbsSurfaceData as O, toLineGeometryData as P, intersectWithEvolution as S, cutAllBisect as T, positionOnCurve as _, healFace as a, filletWithEvolution as b, isValid as c, draft as d, fillet as f, variableFillet as g, thicken as h, heal as i, toGroupedBufferGeometryData as j, chamferDistAngle as k, solidFromShell as l, shell as m, fixSelfIntersection as n, healSolid as o, offset as p, fixShape as r, healWire as s, autoHeal as t, chamfer as u, chamferWithEvolution as v, checkBoolean as w, fuseWithEvolution as x, cutWithEvolution as y };
|
|
@@ -155,249 +155,6 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
155
155
|
return require_errors.ok(wrapped);
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
|
-
//#region src/topology/adjacencyFns.ts
|
|
159
|
-
/**
|
|
160
|
-
* Topology adjacency queries — find related sub-shapes within a parent shape.
|
|
161
|
-
*
|
|
162
|
-
* Uses cached topology extraction and an edge→faces adjacency map
|
|
163
|
-
* (built once per parent shape and cached) to avoid redundant WASM calls.
|
|
164
|
-
*/
|
|
165
|
-
function wrapAll(shapes, type) {
|
|
166
|
-
return shapes.map((s) => require_shapeTypes.castShapeWithKnownType(s, type));
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Iterate sub-shapes of `parentKernel` of the given `type`, deduplicate by
|
|
170
|
-
* hash+isSame, and return branded handles of type `T`.
|
|
171
|
-
*
|
|
172
|
-
* Used by edgesOfFace, wiresOfFace, and verticesOfEdge — all of which need
|
|
173
|
-
* the same deduplicated-children pattern on a raw KernelShape.
|
|
174
|
-
*/
|
|
175
|
-
function deduplicatedSubShapes(parentKernel, type) {
|
|
176
|
-
const kernel = require_shapeTypes.getKernel();
|
|
177
|
-
const items = kernel.iterShapes(parentKernel, type);
|
|
178
|
-
const results = [];
|
|
179
|
-
const seen = /* @__PURE__ */ new Map();
|
|
180
|
-
for (const item of items) {
|
|
181
|
-
const hash = kernel.hashCode(item, require_constants.HASH_CODE_MAX);
|
|
182
|
-
const bucket = seen.get(hash);
|
|
183
|
-
if (!bucket) {
|
|
184
|
-
seen.set(hash, [item]);
|
|
185
|
-
results.push(item);
|
|
186
|
-
} else if (!bucket.some((r) => kernel.isSame(r, item))) {
|
|
187
|
-
bucket.push(item);
|
|
188
|
-
results.push(item);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return wrapAll(results, type);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Build or retrieve the cached edge→faces adjacency map for a parent shape.
|
|
195
|
-
* Maps edge hash codes to edge-face pairs, storing the edge alongside each
|
|
196
|
-
* face so facesOfEdge can verify via isSame without re-extracting face edges.
|
|
197
|
-
*/
|
|
198
|
-
function getEdgeToFacesMap(parent) {
|
|
199
|
-
const cache = require_topologyQueryFns.getOrCreateCache(parent);
|
|
200
|
-
if (cache.edgeToFaces) return cache.edgeToFaces;
|
|
201
|
-
const kernel = require_shapeTypes.getKernel();
|
|
202
|
-
const edgeToFaces = /* @__PURE__ */ new Map();
|
|
203
|
-
const allFaces = kernel.iterShapes(parent.wrapped, "face");
|
|
204
|
-
for (const f of allFaces) {
|
|
205
|
-
const edges = kernel.iterShapes(f, "edge");
|
|
206
|
-
for (const e of edges) {
|
|
207
|
-
const hash = kernel.hashCode(e, require_constants.HASH_CODE_MAX);
|
|
208
|
-
let bucket = edgeToFaces.get(hash);
|
|
209
|
-
if (!bucket) {
|
|
210
|
-
bucket = [];
|
|
211
|
-
edgeToFaces.set(hash, bucket);
|
|
212
|
-
}
|
|
213
|
-
if (!bucket.some((entry) => kernel.isSame(entry.edge, e) && kernel.isSame(entry.face, f))) bucket.push({
|
|
214
|
-
edge: e,
|
|
215
|
-
face: f
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
cache.edgeToFaces = edgeToFaces;
|
|
220
|
-
return edgeToFaces;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Build or retrieve the cached vertex→faces adjacency map for a parent shape —
|
|
224
|
-
* the vertex analogue of {@link getEdgeToFacesMap}.
|
|
225
|
-
*/
|
|
226
|
-
function getVertexToFacesMap(parent) {
|
|
227
|
-
const cache = require_topologyQueryFns.getOrCreateCache(parent);
|
|
228
|
-
if (cache.vertexToFaces) return cache.vertexToFaces;
|
|
229
|
-
const kernel = require_shapeTypes.getKernel();
|
|
230
|
-
const vertexToFaces = /* @__PURE__ */ new Map();
|
|
231
|
-
for (const f of kernel.iterShapes(parent.wrapped, "face")) for (const v of kernel.iterShapes(f, "vertex")) {
|
|
232
|
-
const hash = kernel.hashCode(v, require_constants.HASH_CODE_MAX);
|
|
233
|
-
let bucket = vertexToFaces.get(hash);
|
|
234
|
-
if (!bucket) {
|
|
235
|
-
bucket = [];
|
|
236
|
-
vertexToFaces.set(hash, bucket);
|
|
237
|
-
}
|
|
238
|
-
if (!bucket.some((entry) => kernel.isSame(entry.vertex, v) && kernel.isSame(entry.face, f))) bucket.push({
|
|
239
|
-
vertex: v,
|
|
240
|
-
face: f
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
cache.vertexToFaces = vertexToFaces;
|
|
244
|
-
return vertexToFaces;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Get all faces adjacent to a given edge within a parent shape.
|
|
248
|
-
*
|
|
249
|
-
* An edge typically borders exactly two faces in a solid, or one face
|
|
250
|
-
* if the edge is on a boundary.
|
|
251
|
-
*
|
|
252
|
-
* @param parent - The parent shape to search within.
|
|
253
|
-
* @param edge - The edge whose adjacent faces to find.
|
|
254
|
-
* @returns Array of unique faces containing the given edge.
|
|
255
|
-
*/
|
|
256
|
-
function facesOfEdge(parent, edge) {
|
|
257
|
-
const kernel = require_shapeTypes.getKernel();
|
|
258
|
-
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
259
|
-
const hash = kernel.hashCode(edge.wrapped, require_constants.HASH_CODE_MAX);
|
|
260
|
-
const bucket = edgeToFaces.get(hash) ?? [];
|
|
261
|
-
const results = [];
|
|
262
|
-
const seen = /* @__PURE__ */ new Map();
|
|
263
|
-
for (const entry of bucket) {
|
|
264
|
-
if (!kernel.isSame(entry.edge, edge.wrapped)) continue;
|
|
265
|
-
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
266
|
-
const fBucket = seen.get(fHash);
|
|
267
|
-
if (!fBucket) {
|
|
268
|
-
seen.set(fHash, [entry.face]);
|
|
269
|
-
results.push(entry.face);
|
|
270
|
-
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
271
|
-
fBucket.push(entry.face);
|
|
272
|
-
results.push(entry.face);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return wrapAll(results, "face");
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get all faces meeting at a vertex (≥3 for a solid corner, fewer on a
|
|
279
|
-
* boundary), via the cached vertex→faces map. The vertex equivalent of
|
|
280
|
-
* {@link facesOfEdge}, with the same hash-bucket + isSame verification.
|
|
281
|
-
*
|
|
282
|
-
* @param parent - The parent shape to search within.
|
|
283
|
-
* @param vertex - The vertex whose adjacent faces to find.
|
|
284
|
-
*/
|
|
285
|
-
function facesOfVertex(parent, vertex) {
|
|
286
|
-
const kernel = require_shapeTypes.getKernel();
|
|
287
|
-
const vertexToFaces = getVertexToFacesMap(parent);
|
|
288
|
-
const hash = kernel.hashCode(vertex.wrapped, require_constants.HASH_CODE_MAX);
|
|
289
|
-
const bucket = vertexToFaces.get(hash) ?? [];
|
|
290
|
-
const results = [];
|
|
291
|
-
const seen = /* @__PURE__ */ new Map();
|
|
292
|
-
for (const entry of bucket) {
|
|
293
|
-
if (!kernel.isSame(entry.vertex, vertex.wrapped)) continue;
|
|
294
|
-
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
295
|
-
const fBucket = seen.get(fHash);
|
|
296
|
-
if (!fBucket) {
|
|
297
|
-
seen.set(fHash, [entry.face]);
|
|
298
|
-
results.push(entry.face);
|
|
299
|
-
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
300
|
-
fBucket.push(entry.face);
|
|
301
|
-
results.push(entry.face);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return wrapAll(results, "face");
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Get all edges bounding a face.
|
|
308
|
-
*
|
|
309
|
-
* @param face - The face whose edges to enumerate.
|
|
310
|
-
* @returns Array of unique edges forming the face boundary.
|
|
311
|
-
*/
|
|
312
|
-
function edgesOfFace(face) {
|
|
313
|
-
return deduplicatedSubShapes(face.wrapped, "edge");
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Get all vertices of a face. The vertex equivalent of {@link edgesOfFace}.
|
|
317
|
-
*
|
|
318
|
-
* @param face - The face whose vertices to enumerate.
|
|
319
|
-
*/
|
|
320
|
-
function verticesOfFace(face) {
|
|
321
|
-
return deduplicatedSubShapes(face.wrapped, "vertex");
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Get all wires of a face (outer wire + inner hole wires).
|
|
325
|
-
* All wires bounding a face are closed by definition.
|
|
326
|
-
*
|
|
327
|
-
* @param face - The face whose wires to enumerate.
|
|
328
|
-
*/
|
|
329
|
-
function wiresOfFace(face) {
|
|
330
|
-
return deduplicatedSubShapes(face.wrapped, "wire");
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Get the start and end vertices of an edge.
|
|
334
|
-
*
|
|
335
|
-
* @param edge - The edge whose vertices to retrieve.
|
|
336
|
-
* @returns Array of 1-2 vertices (1 if degenerate/closed, 2 otherwise).
|
|
337
|
-
*/
|
|
338
|
-
function verticesOfEdge(edge) {
|
|
339
|
-
return deduplicatedSubShapes(edge.wrapped, "vertex");
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Get all faces that share at least one edge with the given face.
|
|
343
|
-
*
|
|
344
|
-
* The returned list does not include the input face itself.
|
|
345
|
-
* Uses the cached edge→faces adjacency map for the parent shape.
|
|
346
|
-
*
|
|
347
|
-
* @param parent - The parent shape to search within.
|
|
348
|
-
* @param face - The face whose neighbors to find.
|
|
349
|
-
* @returns Array of unique adjacent faces (excluding the input face).
|
|
350
|
-
*/
|
|
351
|
-
function adjacentFaces(parent, face) {
|
|
352
|
-
const kernel = require_shapeTypes.getKernel();
|
|
353
|
-
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
354
|
-
const faceEdgeHandles = deduplicatedSubShapes(face.wrapped, "edge");
|
|
355
|
-
const neighborRaw = [];
|
|
356
|
-
const seen = /* @__PURE__ */ new Map();
|
|
357
|
-
for (const edgeHandle of faceEdgeHandles) {
|
|
358
|
-
const hash = kernel.hashCode(edgeHandle.wrapped, require_constants.HASH_CODE_MAX);
|
|
359
|
-
const entries = edgeToFaces.get(hash) ?? [];
|
|
360
|
-
for (const entry of entries) {
|
|
361
|
-
if (kernel.isSame(entry.face, face.wrapped)) continue;
|
|
362
|
-
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
363
|
-
const bucket = seen.get(fHash);
|
|
364
|
-
if (!bucket) {
|
|
365
|
-
seen.set(fHash, [entry.face]);
|
|
366
|
-
neighborRaw.push(entry.face);
|
|
367
|
-
} else if (!bucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
368
|
-
bucket.push(entry.face);
|
|
369
|
-
neighborRaw.push(entry.face);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return wrapAll(neighborRaw, "face");
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Get all edges shared between two faces.
|
|
377
|
-
*
|
|
378
|
-
* @param face1 - The first face.
|
|
379
|
-
* @param face2 - The second face.
|
|
380
|
-
* @returns Array of edges present in both faces (via isSame comparison).
|
|
381
|
-
*/
|
|
382
|
-
function sharedEdges(face1, face2) {
|
|
383
|
-
const kernel = require_shapeTypes.getKernel();
|
|
384
|
-
const edges1 = kernel.iterShapes(face1.wrapped, "edge");
|
|
385
|
-
const edges2 = kernel.iterShapes(face2.wrapped, "edge");
|
|
386
|
-
const edge2Map = /* @__PURE__ */ new Map();
|
|
387
|
-
for (const e2 of edges2) {
|
|
388
|
-
const hash = kernel.hashCode(e2, require_constants.HASH_CODE_MAX);
|
|
389
|
-
let bucket = edge2Map.get(hash);
|
|
390
|
-
if (!bucket) {
|
|
391
|
-
bucket = [];
|
|
392
|
-
edge2Map.set(hash, bucket);
|
|
393
|
-
}
|
|
394
|
-
bucket.push(e2);
|
|
395
|
-
}
|
|
396
|
-
const shared = [];
|
|
397
|
-
for (const e1 of edges1) if (edge2Map.get(kernel.hashCode(e1, 2147483647))?.some((e2) => kernel.isSame(e1, e2))) shared.push(e1);
|
|
398
|
-
return wrapAll(shared, "edge");
|
|
399
|
-
}
|
|
400
|
-
//#endregion
|
|
401
158
|
//#region src/topology/nurbsFns.ts
|
|
402
159
|
/**
|
|
403
160
|
* Extract NURBS data from a BSpline or Bezier edge.
|
|
@@ -1437,12 +1194,6 @@ function fixSelfIntersection(wire) {
|
|
|
1437
1194
|
}
|
|
1438
1195
|
}
|
|
1439
1196
|
//#endregion
|
|
1440
|
-
Object.defineProperty(exports, "adjacentFaces", {
|
|
1441
|
-
enumerable: true,
|
|
1442
|
-
get: function() {
|
|
1443
|
-
return adjacentFaces;
|
|
1444
|
-
}
|
|
1445
|
-
});
|
|
1446
1197
|
Object.defineProperty(exports, "autoHeal", {
|
|
1447
1198
|
enumerable: true,
|
|
1448
1199
|
get: function() {
|
|
@@ -1491,24 +1242,6 @@ Object.defineProperty(exports, "draft", {
|
|
|
1491
1242
|
return draft;
|
|
1492
1243
|
}
|
|
1493
1244
|
});
|
|
1494
|
-
Object.defineProperty(exports, "edgesOfFace", {
|
|
1495
|
-
enumerable: true,
|
|
1496
|
-
get: function() {
|
|
1497
|
-
return edgesOfFace;
|
|
1498
|
-
}
|
|
1499
|
-
});
|
|
1500
|
-
Object.defineProperty(exports, "facesOfEdge", {
|
|
1501
|
-
enumerable: true,
|
|
1502
|
-
get: function() {
|
|
1503
|
-
return facesOfEdge;
|
|
1504
|
-
}
|
|
1505
|
-
});
|
|
1506
|
-
Object.defineProperty(exports, "facesOfVertex", {
|
|
1507
|
-
enumerable: true,
|
|
1508
|
-
get: function() {
|
|
1509
|
-
return facesOfVertex;
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
1245
|
Object.defineProperty(exports, "fillet", {
|
|
1513
1246
|
enumerable: true,
|
|
1514
1247
|
get: function() {
|
|
@@ -1605,12 +1338,6 @@ Object.defineProperty(exports, "positionOnCurve", {
|
|
|
1605
1338
|
return positionOnCurve;
|
|
1606
1339
|
}
|
|
1607
1340
|
});
|
|
1608
|
-
Object.defineProperty(exports, "sharedEdges", {
|
|
1609
|
-
enumerable: true,
|
|
1610
|
-
get: function() {
|
|
1611
|
-
return sharedEdges;
|
|
1612
|
-
}
|
|
1613
|
-
});
|
|
1614
1341
|
Object.defineProperty(exports, "shell", {
|
|
1615
1342
|
enumerable: true,
|
|
1616
1343
|
get: function() {
|
|
@@ -1671,21 +1398,3 @@ Object.defineProperty(exports, "variableFillet", {
|
|
|
1671
1398
|
return variableFillet;
|
|
1672
1399
|
}
|
|
1673
1400
|
});
|
|
1674
|
-
Object.defineProperty(exports, "verticesOfEdge", {
|
|
1675
|
-
enumerable: true,
|
|
1676
|
-
get: function() {
|
|
1677
|
-
return verticesOfEdge;
|
|
1678
|
-
}
|
|
1679
|
-
});
|
|
1680
|
-
Object.defineProperty(exports, "verticesOfFace", {
|
|
1681
|
-
enumerable: true,
|
|
1682
|
-
get: function() {
|
|
1683
|
-
return verticesOfFace;
|
|
1684
|
-
}
|
|
1685
|
-
});
|
|
1686
|
-
Object.defineProperty(exports, "wiresOfFace", {
|
|
1687
|
-
enumerable: true,
|
|
1688
|
-
get: function() {
|
|
1689
|
-
return wiresOfFace;
|
|
1690
|
-
}
|
|
1691
|
-
});
|
package/dist/index.d.ts
CHANGED
|
@@ -102,8 +102,8 @@ export { checkBoolean } from './topology/booleanDiagnosticFns.js';
|
|
|
102
102
|
export type { CheckBooleanResult, BooleanIssue, BooleanOpType, BooleanDiagnostics, } from './kernel/types.js';
|
|
103
103
|
export { fuseWithEvolution, cutWithEvolution, intersectWithEvolution, filletWithEvolution, chamferWithEvolution, shellWithEvolution, type EvolutionResult, } from './topology/evolutionFns.js';
|
|
104
104
|
export type { ShapeEvolution } from './kernel/types.js';
|
|
105
|
-
export { captureHint, assignRoles, createRef, updateRoles, resolveRef, defaultScorer, createEdgeRef, resolveEdgeRef, createVertexRef, resolveVertexRef, createDerivedFaceRef, resolveDerivedFaceRef, } from './topology/shapeRef/index.js';
|
|
106
|
-
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, FaceScorer, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, VertexHint, VertexRef, ResolvedVertexRef, BrokenVertexRef, DerivedFaceHint, DerivedFaceRef, ResolvedDerivedFaceRef, BrokenDerivedFaceRef, } from './topology/shapeRef/index.js';
|
|
105
|
+
export { captureHint, assignRoles, createRef, updateRoles, resolveRef, defaultScorer, createEdgeRef, resolveEdgeRef, createVertexRef, resolveVertexRef, createDerivedFaceRef, resolveDerivedFaceRef, isLineageRef, isFaceRef, isEdgeRef, isVertexRef, isDerivedFaceRef, resolveLineageRef, resolveRefIn, resolveRefParams, } from './topology/shapeRef/index.js';
|
|
106
|
+
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, FaceScorer, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, VertexHint, VertexRef, ResolvedVertexRef, BrokenVertexRef, DerivedFaceHint, DerivedFaceRef, ResolvedDerivedFaceRef, BrokenDerivedFaceRef, LineageRef, ResolvedEntity, BrokenReason, LineageResolution, } from './topology/shapeRef/index.js';
|
|
107
107
|
export { surfaceFromGrid, surfaceFromImage, type SurfaceFromGridOptions, type SurfaceFromImageOptions, } from './topology/surfaceFns.js';
|
|
108
108
|
export { hull, type HullOptions } from './topology/hullFns.js';
|
|
109
109
|
export { convexHull } from './operations/convexHullFns.js';
|