@code3d/core 0.0.1-alpha.7 → 0.0.1-alpha.8
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/README.md +42 -1
- package/bld/chunks/{chunk-TCMEEKWL.js → chunk-EWPRWRLV.js} +2 -2
- package/bld/chunks/{chunk-VHSPHJ5F.js → chunk-HSU2FH3L.js} +3 -3
- package/bld/chunks/{chunk-4WLVDYUJ.js → chunk-MICNLFBF.js} +401 -76
- package/bld/chunks/chunk-MICNLFBF.js.map +7 -0
- package/bld/chunks/{chunk-C3AJ6WNB.js → chunk-OAVABPL5.js} +2 -2
- package/bld/library/index.d.ts +2 -2
- package/bld/library/index.d.ts.map +1 -1
- package/bld/library/index.js +3 -1
- package/bld/library/loft.d.ts.map +1 -1
- package/bld/library/replicad.js +2 -2
- package/bld/library/runtime.d.ts +57 -2
- package/bld/library/runtime.d.ts.map +1 -1
- package/bld/library/topology.d.ts +4 -2
- package/bld/library/topology.d.ts.map +1 -1
- package/bld/node/index.js +5 -3
- package/bld/node/replicad.js +4 -4
- package/bld/tooling/index.d.ts +1 -1
- package/bld/tooling/index.d.ts.map +1 -1
- package/bld/tooling/index.js +2 -2
- package/package.json +1 -1
- package/src/library/index.ts +3 -0
- package/src/library/loft.ts +5 -1
- package/src/library/runtime.ts +491 -37
- package/src/library/shell.ts +3 -3
- package/src/library/topology.ts +24 -15
- package/src/tooling/index.ts +1 -0
- package/bld/chunks/chunk-4WLVDYUJ.js.map +0 -7
- /package/bld/chunks/{chunk-TCMEEKWL.js.map → chunk-EWPRWRLV.js.map} +0 -0
- /package/bld/chunks/{chunk-VHSPHJ5F.js.map → chunk-HSU2FH3L.js.map} +0 -0
- /package/bld/chunks/{chunk-C3AJ6WNB.js.map → chunk-OAVABPL5.js.map} +0 -0
package/src/library/shell.ts
CHANGED
|
@@ -119,7 +119,7 @@ function openShell(
|
|
|
119
119
|
return {
|
|
120
120
|
shape: result,
|
|
121
121
|
topology: transferShapeTopology(
|
|
122
|
-
[{shape, topology,
|
|
122
|
+
[{shape, topology, namespace: 'preserve'}],
|
|
123
123
|
result,
|
|
124
124
|
builder,
|
|
125
125
|
),
|
|
@@ -202,12 +202,12 @@ function closedShell(
|
|
|
202
202
|
} finally {
|
|
203
203
|
shells.delete();
|
|
204
204
|
}
|
|
205
|
-
// Original boundaries retain their
|
|
205
|
+
// Original boundaries retain their IDs for either direction. Offset
|
|
206
206
|
// boundaries are new topology, even when OCCT has generation history.
|
|
207
207
|
return {
|
|
208
208
|
shape: result,
|
|
209
209
|
topology: transferShapeTopology(
|
|
210
|
-
[{shape, topology,
|
|
210
|
+
[{shape, topology, namespace: 'preserve'}],
|
|
211
211
|
result,
|
|
212
212
|
cut,
|
|
213
213
|
),
|
package/src/library/topology.ts
CHANGED
|
@@ -107,6 +107,8 @@ function topologyShapes(shape: AnyShape, kind: TopologyKind): AnyShape[] {
|
|
|
107
107
|
type StableTopology = Readonly<{
|
|
108
108
|
/** IDs aligned with the corresponding shape traversal order. */
|
|
109
109
|
ids: readonly TopologyId[];
|
|
110
|
+
/** Next local ID; retained across edits so retired IDs cannot be reused. */
|
|
111
|
+
nextId: number;
|
|
110
112
|
}>;
|
|
111
113
|
|
|
112
114
|
export type VertexTopology = StableTopology;
|
|
@@ -519,7 +521,7 @@ function modifyEdges(
|
|
|
519
521
|
return {
|
|
520
522
|
shape: result,
|
|
521
523
|
topology: transferShapeTopology(
|
|
522
|
-
[{shape, topology: source,
|
|
524
|
+
[{shape, topology: source, namespace: 'preserve'}],
|
|
523
525
|
result,
|
|
524
526
|
builder,
|
|
525
527
|
),
|
|
@@ -616,8 +618,8 @@ export function assertTopologyId(kind: TopologyKind, id: TopologyId): void {
|
|
|
616
618
|
export type TopologyInput = Readonly<{
|
|
617
619
|
shape: AnyShape;
|
|
618
620
|
topology: ShapeTopology;
|
|
619
|
-
/**
|
|
620
|
-
|
|
621
|
+
/** Input prefix, unchanged namespace for edits, or an internal operation step. */
|
|
622
|
+
namespace: number | 'preserve' | 'intermediate';
|
|
621
623
|
}>;
|
|
622
624
|
|
|
623
625
|
/** Returns owned handles, released by the transfer after matching. */
|
|
@@ -636,23 +638,26 @@ export function transferShapeTopology(
|
|
|
636
638
|
const transfer = (kind: TopologyKind): StableTopology => {
|
|
637
639
|
const originals: AnyShape[][] = [];
|
|
638
640
|
const results = topologyShapes(output, kind);
|
|
641
|
+
let nextId = 1;
|
|
639
642
|
try {
|
|
640
643
|
const candidates = inputs.flatMap((input, inputIndex) => {
|
|
641
644
|
const shapes = topologyShapes(input.shape, kind);
|
|
642
645
|
originals.push(shapes);
|
|
643
646
|
const source = input.topology[topologyMetadata[kind].plural];
|
|
644
647
|
assertTopologyLength(kind, shapes, source);
|
|
648
|
+
if (input.namespace === 'preserve')
|
|
649
|
+
nextId = Math.max(nextId, source.nextId);
|
|
645
650
|
return shapes.map((shape, index) => {
|
|
646
651
|
const id = source.ids[index];
|
|
647
652
|
// Numeric elements in an internal prefix are still new to this
|
|
648
653
|
// operation. Reallocate them with the final traversal, without exposing
|
|
649
654
|
// internal creation steps or reserving numbers for discarded geometry.
|
|
650
655
|
const inherited =
|
|
651
|
-
input.
|
|
652
|
-
? inheritedTopologyId(input.
|
|
653
|
-
: typeof id
|
|
654
|
-
?
|
|
655
|
-
:
|
|
656
|
+
typeof input.namespace === 'number'
|
|
657
|
+
? inheritedTopologyId(input.namespace, id)
|
|
658
|
+
: input.namespace === 'preserve' || typeof id !== 'number'
|
|
659
|
+
? id
|
|
660
|
+
: undefined;
|
|
656
661
|
const unchanged = matchingOutputShapes(shape.wrapped, results);
|
|
657
662
|
if (unchanged.length) return {id: inherited, matches: unchanged};
|
|
658
663
|
if (typeof history !== 'function') {
|
|
@@ -693,10 +698,8 @@ export function transferShapeTopology(
|
|
|
693
698
|
inherited.set(index, candidate.id);
|
|
694
699
|
}
|
|
695
700
|
}
|
|
696
|
-
|
|
697
|
-
return stableTopology(
|
|
698
|
-
results.map((_, index) => inherited.get(index) ?? nextId++),
|
|
699
|
-
);
|
|
701
|
+
const ids = results.map((_, index) => inherited.get(index) ?? nextId++);
|
|
702
|
+
return stableTopology(ids, nextId);
|
|
700
703
|
} finally {
|
|
701
704
|
originals.forEach(deleteShapes);
|
|
702
705
|
deleteShapes(results);
|
|
@@ -769,11 +772,17 @@ function stableGroupIds(
|
|
|
769
772
|
function initialTopology(
|
|
770
773
|
shapes: readonly (ReplicadVertex | ReplicadEdge | ReplicadFace)[],
|
|
771
774
|
): StableTopology {
|
|
772
|
-
return stableTopology(
|
|
775
|
+
return stableTopology(
|
|
776
|
+
shapes.map((_, index) => index + 1),
|
|
777
|
+
shapes.length + 1,
|
|
778
|
+
);
|
|
773
779
|
}
|
|
774
780
|
|
|
775
|
-
function stableTopology(
|
|
776
|
-
|
|
781
|
+
function stableTopology(
|
|
782
|
+
ids: readonly TopologyId[],
|
|
783
|
+
nextId: number,
|
|
784
|
+
): StableTopology {
|
|
785
|
+
return {ids, nextId};
|
|
777
786
|
}
|
|
778
787
|
|
|
779
788
|
function shapeTopology(
|