@iyulab/u-nesting 0.5.1 → 0.6.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/README.md CHANGED
@@ -106,11 +106,45 @@ const cutting = JSON.parse(optimize_cutting_path(JSON.stringify({
106
106
  cut_speed: 100.0,
107
107
  rapid_speed: 500.0,
108
108
  exterior_direction: "cw",
109
- interior_direction: "ccw"
109
+ interior_direction: "ccw",
110
+ time_limit_ms: 2000 // Bound the sequencing pass (see below)
110
111
  }
111
112
  })));
112
113
  ```
113
114
 
115
+ ### `optimize_cutting_path` Request
116
+
117
+ ```typescript
118
+ interface CuttingRequest {
119
+ geometries: Geometry[]; // Same shape as solve_2d geometries
120
+ solve_result: SolveResult; // The parsed result returned by solve_2d
121
+ cutting_config?: {
122
+ kerf_width?: number; // Kerf compensation width (default: 0 = off)
123
+ pierce_weight?: number; // Pierce-count weight in cost (default: 10)
124
+ max_2opt_iterations?: number; // 2-opt iteration cap (default: 1000)
125
+ time_limit_ms?: number; // Wall-clock budget (ms) for the 2-opt phase.
126
+ // 0 = unlimited. Default: 5000.
127
+ rapid_speed?: number; // For time estimation only (default: 1000)
128
+ cut_speed?: number; // For time estimation only (default: 100)
129
+ exterior_direction?: string; // "ccw" | "cw" | "auto" (default: "auto")
130
+ interior_direction?: string; // "ccw" | "cw" | "auto" (default: "auto")
131
+ home_position?: [number, number]; // Head start/end point (default: [0,0])
132
+ pierce_candidates?: number; // Candidate pierce points per contour (default: 1)
133
+ tolerance?: number; // Geometric comparison tolerance (default: 1e-6)
134
+ };
135
+ }
136
+ ```
137
+
138
+ > **`time_limit_ms` (anytime bound).** Cutting-path sequencing runs a
139
+ > nearest-neighbor construction followed by 2-opt improvement. The 2-opt
140
+ > neighborhood is `O(n²)` candidate moves per pass, so on large jobs (e.g. many
141
+ > identical parts filling a sheet) the iteration cap alone can run for seconds
142
+ > and block the calling thread — in the browser this freezes the whole tab.
143
+ > `time_limit_ms` caps that phase; when the budget is exceeded the best sequence
144
+ > found so far is returned. Cut order is a heuristic, so early termination never
145
+ > invalidates the result — it only trades some optimality for responsiveness.
146
+ > Set `0` to disable the wall-clock bound (native/batch callers only).
147
+
114
148
  ## Input Schemas
115
149
 
116
150
  ### `solve_2d` Request
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "iyulab"
6
6
  ],
7
7
  "description": "WebAssembly bindings for U-Nesting spatial optimization engine",
8
- "version": "0.5.1",
8
+ "version": "0.6.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "types": "./u_nesting_wasm.d.ts",
41
41
  "default": "./u_nesting_wasm.js"
42
- }
42
+ },
43
+ "./package.json": "./package.json"
43
44
  }
44
45
  }
Binary file