nodi-modular 0.0.13 → 0.0.14

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/index.d.ts CHANGED
@@ -6,68 +6,106 @@ export interface GeometryTransformInterop {
6
6
  transform: TransformInterop;
7
7
  }
8
8
 
9
- export type NodeOutput = (Map<string, Item[]> | undefined)[];
10
-
11
9
  /**
12
10
  * Evaluation item interoperability type.
13
11
  */
14
12
  export type Item = { variant: "Bool"; data: boolean } | { variant: "String"; data: string } | { variant: "Number"; data: number } | { variant: "Domain"; data: Domain } | { variant: "Vector3"; data: Vector3<number> } | { variant: "Matrix4"; data: Matrix4<number> } | { variant: "Complex"; data: Complex<number> } | { variant: "Point3"; data: Point3<number> } | { variant: "Plane"; data: Plane } | { variant: "GeometryTransform"; data: GeometryTransformInterop } | { variant: "MeshFace"; data: MeshTriangleFace };
15
13
 
16
- export interface NodeCreationSetting {
17
- id: NodeId;
14
+ export type NodeOutput = (Map<string, Item[]> | undefined)[];
15
+
16
+ /**
17
+ * Interop struct for node
18
+ */
19
+ export interface NodeInterop {
20
+ /**
21
+ * Node variant
22
+ */
18
23
  variant: string;
19
- name?: string;
20
- label?: string;
21
- inputs?: number;
22
- outputs?: number;
24
+ /**
25
+ * Node identifier
26
+ */
27
+ id: string;
28
+ name: string;
29
+ label: string | undefined;
30
+ description: string;
31
+ /**
32
+ * Input parameters
33
+ */
34
+ inputs: IOInterop[];
35
+ /**
36
+ * Input variables
37
+ */
38
+ inputVariables: IOVariables | undefined;
39
+ /**
40
+ * Output parameters
41
+ */
42
+ outputs: IOInterop[];
43
+ /**
44
+ * Output variables
45
+ */
46
+ outputVariables: IOVariables | undefined;
47
+ /**
48
+ * Node properties
49
+ */
23
50
  properties: NodePropertyInterop[];
24
- enabled?: boolean;
25
- visible?: boolean;
26
- }
27
-
28
- export interface NodeConnectionInterop {
29
- outputNodeId: string;
30
- outputIndex: number;
31
- inputNodeId: string;
32
- inputIndex: number;
33
- inputConnectionIndex: number | undefined;
51
+ enabled: boolean;
52
+ visible: boolean;
53
+ meta: NodeMetaInterop;
34
54
  }
35
55
 
36
- export interface IndicesInteropHandle {
37
- count: number;
38
- indices: number;
56
+ export interface NodeEntityInterop {
57
+ variant: string;
58
+ id: string;
59
+ name: string;
60
+ label: string | undefined;
61
+ inputs: string[];
62
+ outputs: string[];
63
+ enabled: boolean;
64
+ visible: boolean;
39
65
  }
40
66
 
41
- export type GeometryInteropVec = GeometryInterop[];
42
-
43
- export type NodeConnectionInteropVec = NodeConnectionInterop[];
44
-
45
- export type NodePropertyInteropVec = NodePropertyInterop[];
46
-
47
- export type NodeInteropVec = NodeInterop[];
48
-
49
- export type EdgeInteropVec = EdgeInterop[];
50
-
51
67
  /**
52
- * Geometry identifier
68
+ * Interop struct for node meta
53
69
  */
54
- export interface GeometryIdentifier {
70
+ export interface NodeMetaInterop {
55
71
  /**
56
- * Parent node ID
72
+ * Error message
57
73
  */
58
- graphNodeSet?: GraphNodeSet;
74
+ error: string | undefined;
59
75
  /**
60
- * Output ID that the geometry is belonged to
76
+ * Node\' output has geometry or not
61
77
  */
62
- outputId: OutputId;
78
+ hasGeometry: boolean;
79
+ }
80
+
81
+ /**
82
+ * Interop struct for evaluation results
83
+ */
84
+ export interface EvaluationInterop {
63
85
  /**
64
- * Geometry ID
86
+ * Processed nodes in the latest evaluation
65
87
  */
66
- geometryId: ID<GeometryProxy>;
88
+ processedNodes: GraphNodeSet[];
67
89
  /**
68
- * Transform matrix in interop format
90
+ * Geometry identifiers in the latest evaluation
69
91
  */
70
- transform: TransformInterop;
92
+ geometryIdentifiers: GeometryIdentifier[];
93
+ }
94
+
95
+ export interface IOInterop {
96
+ id: string;
97
+ name: string;
98
+ accessType: AccessTypes;
99
+ hint: TypeHint | undefined;
100
+ connections: string[];
101
+ }
102
+
103
+ export interface DataTreeInterop {
104
+ branches: IndexMap<string, string[]>;
105
+ }
106
+
107
+ export interface DataTreeFormatInterop {
108
+ outputs: IndexMap<string, string>;
71
109
  }
72
110
 
73
111
  export interface GeometrySpreadsheet {
@@ -77,8 +115,57 @@ export interface GeometrySpreadsheet {
77
115
  meshes: MeshInterop[];
78
116
  }
79
117
 
80
- export interface GroupInteropHandle {
81
- objects: GeometryInteropHandleProxy[];
118
+ export type GeometryInteropVec = GeometryInterop[];
119
+
120
+ export type NodeConnectionInteropVec = NodeConnectionInterop[];
121
+
122
+ export type NodePropertyInteropVec = NodePropertyInterop[];
123
+
124
+ export type NodeInteropVec = NodeInterop[];
125
+
126
+ export type EdgeInteropVec = EdgeInterop[];
127
+
128
+ export type NodeSectionInterop = { type: "section"; content: NodeFolderInterop } | { type: "item"; content: NodeItemInterop };
129
+
130
+ export interface NodeItemInterop {
131
+ key: string;
132
+ name: string;
133
+ }
134
+
135
+ export type NodeFolderInterop = IndexMap<string, NodeSectionInterop>;
136
+
137
+ export interface NodeMapInterop {
138
+ folder: NodeFolderInterop;
139
+ }
140
+
141
+ /**
142
+ * Curve interop handle for wasm interop
143
+ * stride = 3 (x, y, z)
144
+ */
145
+ export interface CurveInteropHandle {
146
+ count: number;
147
+ vertices: number;
148
+ transform: TransformInterop | undefined;
149
+ }
150
+
151
+ export interface MeshInteropHandle {
152
+ count: number;
153
+ vertices: number;
154
+ normals: number;
155
+ indices: IndicesInteropHandle | undefined;
156
+ transform: TransformInterop | undefined;
157
+ }
158
+
159
+ export interface NodeCreationSetting {
160
+ id: NodeId;
161
+ variant: string;
162
+ name?: string;
163
+ label?: string;
164
+ inputs?: number;
165
+ outputs?: number;
166
+ properties: NodePropertyInterop[];
167
+ enabled?: boolean;
168
+ visible?: boolean;
82
169
  }
83
170
 
84
171
  /**
@@ -165,46 +252,12 @@ export interface AdaptiveTessellationOptions {
165
252
  maxDepth: number;
166
253
  }
167
254
 
168
- export type NodeSectionInterop = { type: "section"; content: NodeFolderInterop } | { type: "item"; content: NodeItemInterop };
169
-
170
- export interface NodeItemInterop {
171
- key: string;
172
- name: string;
173
- }
174
-
175
- export type NodeFolderInterop = IndexMap<string, NodeSectionInterop>;
176
-
177
- export interface NodeMapInterop {
178
- folder: NodeFolderInterop;
179
- }
180
-
181
- /**
182
- * Curve interop handle for wasm interop
183
- * stride = 3 (x, y, z)
184
- */
185
- export interface CurveInteropHandle {
186
- count: number;
187
- vertices: number;
188
- transform: TransformInterop | undefined;
189
- }
190
-
191
- export interface IOInterop {
192
- id: string;
193
- name: string;
194
- accessType: AccessTypes;
195
- hint: TypeHint | undefined;
196
- connections: string[];
197
- }
198
-
199
- export interface EdgeInterop {
200
- source: EdgeUnitInterop<OutputId>;
201
- destination: EdgeUnitInterop<InputId>;
202
- empty: boolean;
203
- }
204
-
205
- export interface EdgeUnitInterop<IO> {
206
- node: NodeId;
207
- io: IO;
255
+ export interface NodeConnectionInterop {
256
+ outputNodeId: string;
257
+ outputIndex: number;
258
+ inputNodeId: string;
259
+ inputIndex: number;
260
+ inputConnectionIndex: number | undefined;
208
261
  }
209
262
 
210
263
  export interface PointListHandleUnit {
@@ -232,128 +285,73 @@ export interface VectorDisplayHandle {
232
285
  export type DisplayProxyHandle = { variant: "Vector"; data: VectorDisplayHandle } | { variant: "PointList"; data: PointListDisplayHandle };
233
286
 
234
287
  /**
235
- * Interop struct for node
288
+ * Interop struct for transform
289
+ * Represents a 4x4 matrix as a 16-element array
236
290
  */
237
- export interface NodeInterop {
291
+ export type TransformInterop = number[];
292
+
293
+ export type GeometryInteropHandleProxy = { variant: "Mesh"; data: MeshInteropHandle } | { variant: "Curve"; data: CurveInteropHandle } | { variant: "Group"; data: GroupInteropHandle };
294
+
295
+ export interface GroupInteropHandle {
296
+ objects: GeometryInteropHandleProxy[];
297
+ }
298
+
299
+ export interface IndicesInteropHandle {
300
+ count: number;
301
+ indices: number;
302
+ }
303
+
304
+ export interface EdgeInterop {
305
+ source: EdgeUnitInterop<OutputId>;
306
+ destination: EdgeUnitInterop<InputId>;
307
+ empty: boolean;
308
+ }
309
+
310
+ export interface EdgeUnitInterop<IO> {
311
+ node: NodeId;
312
+ io: IO;
313
+ }
314
+
315
+ /**
316
+ * Geometry identifier
317
+ */
318
+ export interface GeometryIdentifier {
238
319
  /**
239
- * Node variant
320
+ * Parent node ID
240
321
  */
241
- variant: string;
322
+ graphNodeSet?: GraphNodeSet;
242
323
  /**
243
- * Node identifier
244
- */
245
- id: string;
246
- name: string;
247
- label: string | undefined;
248
- description: string;
249
- /**
250
- * Input parameters
251
- */
252
- inputs: IOInterop[];
253
- /**
254
- * Input variables
255
- */
256
- inputVariables: IOVariables | undefined;
257
- /**
258
- * Output parameters
259
- */
260
- outputs: IOInterop[];
261
- /**
262
- * Output variables
263
- */
264
- outputVariables: IOVariables | undefined;
265
- /**
266
- * Node properties
324
+ * Output ID that the geometry is belonged to
267
325
  */
268
- properties: NodePropertyInterop[];
269
- enabled: boolean;
270
- visible: boolean;
271
- meta: NodeMetaInterop;
272
- }
273
-
274
- export interface NodeEntityInterop {
275
- variant: string;
276
- id: string;
277
- name: string;
278
- label: string | undefined;
279
- inputs: string[];
280
- outputs: string[];
281
- enabled: boolean;
282
- visible: boolean;
283
- }
284
-
285
- /**
286
- * Interop struct for node meta
287
- */
288
- export interface NodeMetaInterop {
326
+ outputId: OutputId;
289
327
  /**
290
- * Error message
328
+ * Geometry ID
291
329
  */
292
- error: string | undefined;
330
+ geometryId: ID<GeometryProxy>;
293
331
  /**
294
- * Node\' output has geometry or not
332
+ * Transform matrix in interop format
295
333
  */
296
- hasGeometry: boolean;
334
+ transform: TransformInterop;
297
335
  }
298
336
 
299
- export type GeometryInteropHandleProxy = { variant: "Mesh"; data: MeshInteropHandle } | { variant: "Curve"; data: CurveInteropHandle } | { variant: "Group"; data: GroupInteropHandle };
300
-
301
- /**
302
- * Interop struct for evaluation results
303
- */
304
- export interface EvaluationInterop {
305
- /**
306
- * Processed nodes in the latest evaluation
307
- */
308
- processedNodes: GraphNodeSet[];
309
- /**
310
- * Geometry identifiers in the latest evaluation
311
- */
312
- geometryIdentifiers: GeometryIdentifier[];
313
- }
337
+ export type GraphMappingTypes = "None" | "Bezier" | "Linear" | "Sine";
314
338
 
315
- export interface MeshInteropHandle {
316
- count: number;
317
- vertices: number;
318
- normals: number;
319
- indices: IndicesInteropHandle | undefined;
320
- transform: TransformInterop | undefined;
339
+ export interface Prune<T, U> {
340
+ connectedComponents: ConnectedComponents<T, U>[];
341
+ bypass: Connection[] | undefined;
321
342
  }
322
343
 
323
344
  /**
324
- * Interop struct for transform
325
- * Represents a 4x4 matrix as a 16-element array
345
+ * Defines the dynamics of an IO parameter.
326
346
  */
327
- export type TransformInterop = number[];
328
-
329
- export interface DataTreeInterop {
330
- branches: IndexMap<string, string[]>;
331
- }
332
-
333
- export interface DataTreeFormatInterop {
334
- outputs: IndexMap<string, string>;
335
- }
336
-
337
- export interface NodePropertyCategoryValue {
338
- candidates: Map<string, number>;
339
- selected: number;
340
- }
341
-
342
- export interface NodePropertyRangeValue {
343
- value: number;
344
- min: number | undefined;
345
- max: number | undefined;
346
- step: number | undefined;
347
+ export interface IOVariables {
348
+ minCount: number;
349
+ maxCount: number;
350
+ defaultCount: number;
351
+ offset: number;
352
+ editable: boolean;
347
353
  }
348
354
 
349
- export type NodePropertyValue = { type: "Number"; content: number } | { type: "Range"; content: NodePropertyRangeValue } | { type: "Range2d"; content: [NodePropertyRangeValue, NodePropertyRangeValue] } | { type: "String"; content: string } | { type: "Bool"; content: boolean } | { type: "NumberVector"; content: number[] } | { type: "Category"; content: NodePropertyCategoryValue } | { type: "Vector2d"; content: [number, number] } | { type: "Vector3d"; content: [number, number, number] } | { type: "Point2d"; content: [number, number] } | { type: "Point3d"; content: [number, number, number] } | { type: "Points2d"; content: [number, number][] } | { type: "Buffer"; content: number[] };
350
-
351
- export type TypeHint = Internal;
352
-
353
- export type AccessTypes = "Item" | "List" | "Tree";
354
-
355
- export type GraphVariant = "Root" | { SubGraph: SubGraphId };
356
-
357
355
  /**
358
356
  * Graph structure
359
357
  */
@@ -368,45 +366,24 @@ export interface Graph<T, U> {
368
366
  sub_graphs?: IndexMap<SubGraphId, SubGraph<T, U>>;
369
367
  }
370
368
 
371
- export interface Prune<T, U> {
372
- connectedComponents: ConnectedComponents<T, U>[];
373
- bypass: Connection[] | undefined;
374
- }
375
-
376
- export type GraphMappingTypes = "None" | "Bezier" | "Linear" | "Sine";
369
+ export type TypeHint = Internal;
377
370
 
378
- export interface IOManager<T, U> {
379
- parameters: IOParameter<T, U>[];
380
- }
371
+ export type GraphVariant = "Root" | { SubGraph: SubGraphId };
381
372
 
382
- export interface Connection {
383
- source: NodeParameter<OutputId>;
384
- destination: NodeParameter<InputId>;
373
+ export interface Node<T> {
374
+ id: NodeId;
375
+ name: string;
376
+ label: string | undefined;
377
+ input: InputIOManager;
378
+ output: OutputIOManager;
379
+ entity: T;
380
+ enabled: boolean;
381
+ visible: boolean;
385
382
  }
386
383
 
387
- export interface NodeParameter<T> {
388
- nodeId: NodeId;
389
- parameterId: T;
390
- parameterIndex: number;
391
- }
384
+ export type OutputIOManager = IOManager<OutputId, InputId>;
392
385
 
393
- /**
394
- * A sub graph is a graph that is a part of a larger graph
395
- */
396
- export interface SubGraph<T, U> {
397
- /**
398
- * The id of the sub graph
399
- */
400
- id: SubGraphId;
401
- /**
402
- * The graph of the sub graph
403
- */
404
- graph: Graph<T, U>;
405
- /**
406
- * The instances of the sub graph
407
- */
408
- instances: SubGraphInstanceId[];
409
- }
386
+ export type InputIOManager = IOManager<InputId, OutputId>;
410
387
 
411
388
  export interface ConnectedComponentNode {
412
389
  sources: NodeId[];
@@ -433,140 +410,63 @@ export interface SubGraphIdSet {
433
410
  instanceId: SubGraphInstanceId;
434
411
  }
435
412
 
436
- /**
437
- * Defines the dynamics of an IO parameter.
438
- */
439
- export interface IOVariables {
440
- minCount: number;
441
- maxCount: number;
442
- defaultCount: number;
443
- offset: number;
444
- editable: boolean;
445
- }
446
-
447
- /**
448
- * A set of node id and instance id
449
- */
450
- export interface GraphNodeSet {
451
- subGraphIdSet: SubGraphIdSet | undefined;
452
- nodeId: NodeId;
413
+ export interface NodePropertyCategoryValue {
414
+ candidates: Map<string, number>;
415
+ selected: number;
453
416
  }
454
417
 
455
- export interface Node<T> {
456
- id: NodeId;
457
- name: string;
458
- label: string | undefined;
459
- input: InputIOManager;
460
- output: OutputIOManager;
461
- entity: T;
462
- enabled: boolean;
463
- visible: boolean;
418
+ export interface NodePropertyRangeValue {
419
+ value: number;
420
+ min: number | undefined;
421
+ max: number | undefined;
422
+ step: number | undefined;
464
423
  }
465
424
 
466
- export type OutputIOManager = IOManager<OutputId, InputId>;
467
-
468
- export type InputIOManager = IOManager<InputId, OutputId>;
469
-
470
-
471
- export type NurbsSurface3D<T = number> = {
472
- control_points: Point4<T>[][];
473
- u_knots: T[];
474
- v_knots: T[];
475
- u_degree: T;
476
- v_degree: T;
477
- };
478
-
479
-
480
- export type BoundingBox3D = {
481
- min: Vector3;
482
- max: Vector3;
483
- };
484
-
485
-
486
- export type Triangle3D = {
487
- a: Point3;
488
- b: Point3;
489
- c: Point3;
490
- };
491
-
492
- /**
493
- * A NURBS surface container
494
- */
495
- export type NurbsSurface = NurbsSurface3D<number>;
425
+ export type NodePropertyValue = { type: "Number"; content: number } | { type: "Range"; content: NodePropertyRangeValue } | { type: "Range2d"; content: [NodePropertyRangeValue, NodePropertyRangeValue] } | { type: "String"; content: string } | { type: "Bool"; content: boolean } | { type: "NumberVector"; content: number[] } | { type: "Category"; content: NodePropertyCategoryValue } | { type: "Vector2d"; content: [number, number] } | { type: "Vector3d"; content: [number, number, number] } | { type: "Point2d"; content: [number, number] } | { type: "Point3d"; content: [number, number, number] } | { type: "Points2d"; content: [number, number][] } | { type: "Buffer"; content: number[] };
496
426
 
497
- /**
498
- * A ellipse curve in 3D space
499
- */
500
- export interface EllipseCurve {
501
- /**
502
- * The base plane of the ellipse
503
- */
504
- plane: Plane;
505
- /**
506
- * The x radius of the ellipse
507
- */
508
- xRadius: number;
509
- /**
510
- * The y radius of the ellipse
511
- */
512
- yRadius: number;
427
+ export interface IOManager<T, U> {
428
+ parameters: IOParameter<T, U>[];
513
429
  }
514
430
 
515
431
  /**
516
- * A circle curve in 3D space
432
+ * A set of node id and instance id
517
433
  */
518
- export interface CircleCurve {
519
- /**
520
- * The base plane of the circle
521
- */
522
- plane: Plane;
523
- /**
524
- * The radius of the circle
525
- */
526
- radius: number;
434
+ export interface GraphNodeSet {
435
+ subGraphIdSet: SubGraphIdSet | undefined;
436
+ nodeId: NodeId;
527
437
  }
528
438
 
439
+ export type AccessTypes = "Item" | "List" | "Tree";
440
+
529
441
  /**
530
- * An arc curve in 3D space
442
+ * A sub graph is a graph that is a part of a larger graph
531
443
  */
532
- export interface ArcCurve {
533
- /**
534
- * The base plane of the arc
535
- */
536
- plane: Plane;
444
+ export interface SubGraph<T, U> {
537
445
  /**
538
- * The start angle of the arc
446
+ * The id of the sub graph
539
447
  */
540
- startAngle: number;
448
+ id: SubGraphId;
541
449
  /**
542
- * The end angle of the arc
450
+ * The graph of the sub graph
543
451
  */
544
- endAngle: number;
452
+ graph: Graph<T, U>;
545
453
  /**
546
- * The radius of the arc
454
+ * The instances of the sub graph
547
455
  */
548
- radius: number;
456
+ instances: SubGraphInstanceId[];
549
457
  }
550
458
 
459
+ export interface Connection {
460
+ source: NodeParameter<OutputId>;
461
+ destination: NodeParameter<InputId>;
462
+ }
463
+
464
+ export interface NodeParameter<T> {
465
+ nodeId: NodeId;
466
+ parameterId: T;
467
+ parameterIndex: number;
468
+ }
551
469
 
552
- export type LineCurve3D = {
553
- a: Point3;
554
- b: Point3;
555
- };
556
-
557
-
558
- export type PolylineCurve2D = {
559
- points: Point2[];
560
- };
561
- export type PolylineCurve3D = {
562
- points: Point3[];
563
- };
564
-
565
- /**
566
- * A collection of geometry objects
567
- */
568
- export type Group = GeometryTransform[];
569
-
570
470
  /**
571
471
  * A surface defined by three points
572
472
  */
@@ -595,33 +495,12 @@ export interface PlaneSurface {
595
495
  */
596
496
  export type CurveProxy = { variant: "Line"; data: LineCurve3D } | { variant: "Arc"; data: ArcCurve } | { variant: "Circle"; data: CircleCurve } | { variant: "Ellipse"; data: EllipseCurve } | { variant: "Rectangle"; data: RectangleCurve } | { variant: "Polyline"; data: PolylineCurve3D } | { variant: "NURBS"; data: NurbsCurve };
597
497
 
598
- /**
599
- * A face of a mesh with three vertices
600
- */
601
- export interface MeshTriangleFace {
602
- a: number;
603
- b: number;
604
- c: number;
605
- }
606
-
607
- /**
608
- * A geometry object with a transformation
609
- */
610
- export interface GeometryTransform {
611
- /**
612
- * The handle to the geometry object
613
- */
614
- geometry: Handle<GeometryProxy>;
615
- /**
616
- * Transformation matrix of the geometry
617
- */
618
- transform: Transform3<number>;
619
- }
620
498
 
621
- /**
622
- * Geometry proxy for various geometry types
623
- */
624
- export type GeometryProxy = { variant: "Curve"; data: CurveProxy } | { variant: "Surface"; data: SurfaceProxy } | { variant: "Brep"; data: Brep } | { variant: "Mesh"; data: Mesh } | { variant: "BBox"; data: OrientedBox } | { variant: "Group"; data: Group };
499
+ export type NurbsCurve3D<T = number> = {
500
+ control_points: Point4<T>[];
501
+ knots: T[];
502
+ degree: T;
503
+ };
625
504
 
626
505
  /**
627
506
  * Interop struct for point cloud data
@@ -637,23 +516,6 @@ export interface PointCloudInterop {
637
516
  transform: Transform3<number>;
638
517
  }
639
518
 
640
- /**
641
- * Proxy for various surface types
642
- */
643
- export type SurfaceProxy = { variant: "Circular"; data: CircularSurface } | { variant: "Triangle"; data: TriangleSurface } | { variant: "Plane"; data: PlaneSurface } | { variant: "NURBS"; data: NurbsSurface } | { variant: "Trimmed"; data: TrimmedSurface };
644
-
645
-
646
- export type NurbsCurve3D<T = number> = {
647
- control_points: Point4<T>[];
648
- knots: T[];
649
- degree: T;
650
- };
651
-
652
- export interface Domain {
653
- min: number;
654
- max: number;
655
- }
656
-
657
519
  /**
658
520
  * Interop struct for mesh data
659
521
  */
@@ -681,58 +543,78 @@ export interface MeshInterop {
681
543
  }
682
544
 
683
545
  /**
684
- * Interop proxy for various geometry types
546
+ * A collection of geometry objects
685
547
  */
686
- export type GeometryInterop = { variant: "Mesh"; data: MeshInterop } | { variant: "Curve"; data: CurveInterop } | { variant: "Point"; data: PointCloudInterop } | { variant: "Plane"; data: Plane } | { variant: "Group"; data: GeometryInterop[] };
548
+ export type Group = GeometryTransform[];
687
549
 
688
550
  /**
689
- * Interop struct for curve data
551
+ * A face of a mesh with three vertices
690
552
  */
691
- export interface CurveInterop {
692
- /**
693
- * Vertices of the curve
694
- */
695
- vertices: [number, number, number][];
696
- /**
697
- * Transform matrix of the curve
698
- */
699
- transform: Transform3<number> | undefined;
553
+ export interface MeshTriangleFace {
554
+ a: number;
555
+ b: number;
556
+ c: number;
700
557
  }
701
558
 
702
559
  /**
703
- * An oriented box in 3D space
560
+ * Proxy for various surface types
704
561
  */
705
- export interface OrientedBox {
562
+ export type SurfaceProxy = { variant: "Circular"; data: CircularSurface } | { variant: "Triangle"; data: TriangleSurface } | { variant: "Plane"; data: PlaneSurface } | { variant: "NURBS"; data: NurbsSurface } | { variant: "Trimmed"; data: TrimmedSurface };
563
+
564
+ /**
565
+ * A circular surface
566
+ */
567
+ export interface CircularSurface {
706
568
  /**
707
- * The plane that the box is aligned to
569
+ * The base plane of the circle
708
570
  */
709
571
  plane: Plane;
710
572
  /**
711
- * The bounding box in the local coordinate system
573
+ * The radius of the circle
712
574
  */
713
- bounds: BoundingBox3D;
575
+ radius: number;
714
576
  }
715
577
 
578
+ export type NurbsCurve = NurbsCurve3D<number>;
579
+
580
+
581
+ export type LineCurve3D = {
582
+ a: Point3;
583
+ b: Point3;
584
+ };
585
+
586
+
587
+ export type PolylineCurve2D = {
588
+ points: Point2[];
589
+ };
590
+ export type PolylineCurve3D = {
591
+ points: Point3[];
592
+ };
593
+
594
+
595
+ export type BoundingBox3D = {
596
+ min: Vector3;
597
+ max: Vector3;
598
+ };
599
+
716
600
  /**
717
- * A rectangle curve in 3D space
601
+ * A ellipse curve in 3D space
718
602
  */
719
- export interface RectangleCurve {
603
+ export interface EllipseCurve {
720
604
  /**
721
- * The base plane of the rectangle
605
+ * The base plane of the ellipse
722
606
  */
723
607
  plane: Plane;
724
608
  /**
725
- * The domain of the rectangle in the plane x axis
609
+ * The x radius of the ellipse
726
610
  */
727
- x: Domain;
611
+ xRadius: number;
728
612
  /**
729
- * The domain of the rectangle in the plane y axis
613
+ * The y radius of the ellipse
730
614
  */
731
- y: Domain;
615
+ yRadius: number;
732
616
  }
733
617
 
734
- export type NurbsCurve = NurbsCurve3D<number>;
735
-
736
618
  /**
737
619
  * Mesh representation with vertices, normals, uv, and index
738
620
  */
@@ -755,10 +637,63 @@ export interface Mesh {
755
637
  index: [number, number, number][];
756
638
  }
757
639
 
640
+
641
+ export type NurbsSurface3D<T = number> = {
642
+ control_points: Point4<T>[][];
643
+ u_knots: T[];
644
+ v_knots: T[];
645
+ u_degree: T;
646
+ v_degree: T;
647
+ };
648
+
649
+
650
+ export type Triangle3D = {
651
+ a: Point3;
652
+ b: Point3;
653
+ c: Point3;
654
+ };
655
+
758
656
  /**
759
- * A circular surface
657
+ * Interop struct for curve data
760
658
  */
761
- export interface CircularSurface {
659
+ export interface CurveInterop {
660
+ /**
661
+ * Vertices of the curve
662
+ */
663
+ vertices: [number, number, number][];
664
+ /**
665
+ * Transform matrix of the curve
666
+ */
667
+ transform: Transform3<number> | undefined;
668
+ }
669
+
670
+ /**
671
+ * A NURBS surface container
672
+ */
673
+ export type NurbsSurface = NurbsSurface3D<number>;
674
+
675
+ /**
676
+ * A rectangle curve in 3D space
677
+ */
678
+ export interface RectangleCurve {
679
+ /**
680
+ * The base plane of the rectangle
681
+ */
682
+ plane: Plane;
683
+ /**
684
+ * The domain of the rectangle in the plane x axis
685
+ */
686
+ x: Domain;
687
+ /**
688
+ * The domain of the rectangle in the plane y axis
689
+ */
690
+ y: Domain;
691
+ }
692
+
693
+ /**
694
+ * A circle curve in 3D space
695
+ */
696
+ export interface CircleCurve {
762
697
  /**
763
698
  * The base plane of the circle
764
699
  */
@@ -769,6 +704,38 @@ export interface CircularSurface {
769
704
  radius: number;
770
705
  }
771
706
 
707
+ /**
708
+ * An arc curve in 3D space
709
+ */
710
+ export interface ArcCurve {
711
+ /**
712
+ * The base plane of the arc
713
+ */
714
+ plane: Plane;
715
+ /**
716
+ * The start angle of the arc
717
+ */
718
+ startAngle: number;
719
+ /**
720
+ * The end angle of the arc
721
+ */
722
+ endAngle: number;
723
+ /**
724
+ * The radius of the arc
725
+ */
726
+ radius: number;
727
+ }
728
+
729
+ /**
730
+ * Geometry proxy for various geometry types
731
+ */
732
+ export type GeometryProxy = { variant: "Curve"; data: CurveProxy } | { variant: "Surface"; data: SurfaceProxy } | { variant: "Brep"; data: Brep } | { variant: "Mesh"; data: Mesh } | { variant: "BBox"; data: OrientedBox } | { variant: "Group"; data: Group };
733
+
734
+ export interface Domain {
735
+ min: number;
736
+ max: number;
737
+ }
738
+
772
739
  /**
773
740
  * Plane representation with origin, normal, x axis, and y axis
774
741
  */
@@ -791,6 +758,39 @@ export interface Plane {
791
758
  yAxis: Vector3<number>;
792
759
  }
793
760
 
761
+ /**
762
+ * Interop proxy for various geometry types
763
+ */
764
+ export type GeometryInterop = { variant: "Mesh"; data: MeshInterop } | { variant: "Curve"; data: CurveInterop } | { variant: "Point"; data: PointCloudInterop } | { variant: "Plane"; data: Plane } | { variant: "Group"; data: GeometryInterop[] };
765
+
766
+ /**
767
+ * An oriented box in 3D space
768
+ */
769
+ export interface OrientedBox {
770
+ /**
771
+ * The plane that the box is aligned to
772
+ */
773
+ plane: Plane;
774
+ /**
775
+ * The bounding box in the local coordinate system
776
+ */
777
+ bounds: BoundingBox3D;
778
+ }
779
+
780
+ /**
781
+ * A geometry object with a transformation
782
+ */
783
+ export interface GeometryTransform {
784
+ /**
785
+ * The handle to the geometry object
786
+ */
787
+ geometry: Handle<GeometryProxy>;
788
+ /**
789
+ * Transformation matrix of the geometry
790
+ */
791
+ transform: Transform3<number>;
792
+ }
793
+
794
794
  /**
795
795
  * Modular structure with a graph handle
796
796
  */
@@ -869,8 +869,8 @@ export interface InitOutput {
869
869
  readonly __externref_table_dealloc: (a: number) => void;
870
870
  readonly __externref_drop_slice: (a: number, b: number) => void;
871
871
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
872
- readonly closure821_externref_shim: (a: number, b: number, c: any) => void;
873
- readonly closure3503_externref_shim: (a: number, b: number, c: any, d: any) => void;
872
+ readonly closure828_externref_shim: (a: number, b: number, c: any) => void;
873
+ readonly closure3485_externref_shim: (a: number, b: number, c: any, d: any) => void;
874
874
  readonly __wbindgen_start: () => void;
875
875
  }
876
876
 
package/index.js CHANGED
@@ -225,11 +225,11 @@ export function do_nothing_just_tell_wasm_bindgen_to_generate_types() {
225
225
  }
226
226
 
227
227
  function __wbg_adapter_52(arg0, arg1, arg2) {
228
- wasm.closure821_externref_shim(arg0, arg1, arg2);
228
+ wasm.closure828_externref_shim(arg0, arg1, arg2);
229
229
  }
230
230
 
231
231
  function __wbg_adapter_145(arg0, arg1, arg2, arg3) {
232
- wasm.closure3503_externref_shim(arg0, arg1, arg2, arg3);
232
+ wasm.closure3485_externref_shim(arg0, arg1, arg2, arg3);
233
233
  }
234
234
 
235
235
  const ModularFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -429,7 +429,7 @@ function __wbg_get_imports() {
429
429
  const ret = Object.entries(arg0);
430
430
  return ret;
431
431
  };
432
- imports.wbg.__wbg_getRandomValues_21a0191e74d0e1d3 = function() { return handleError(function (arg0, arg1) {
432
+ imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
433
433
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
434
434
  }, arguments) };
435
435
  imports.wbg.__wbg_getRandomValues_3d90134a348e46b3 = function() { return handleError(function (arg0, arg1) {
@@ -685,8 +685,8 @@ function __wbg_get_imports() {
685
685
  const ret = false;
686
686
  return ret;
687
687
  };
688
- imports.wbg.__wbindgen_closure_wrapper3458 = function(arg0, arg1, arg2) {
689
- const ret = makeMutClosure(arg0, arg1, 822, __wbg_adapter_52);
688
+ imports.wbg.__wbindgen_closure_wrapper3452 = function(arg0, arg1, arg2) {
689
+ const ret = makeMutClosure(arg0, arg1, 829, __wbg_adapter_52);
690
690
  return ret;
691
691
  };
692
692
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
package/index_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Masatatsu Nakamura <masatatsu.nakamura@gmail.com"
6
6
  ],
7
7
  "description": "Modular is a module project designed to import node graphs created in Nodi in JSON format, enabling the extraction of geometric data generated based on the node graph structure.",
8
- "version": "0.0.13",
8
+ "version": "0.0.14",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",