okgeometry-api 0.2.7 → 0.2.10

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.
Files changed (65) hide show
  1. package/dist/Arc.d.ts +7 -0
  2. package/dist/Arc.d.ts.map +1 -1
  3. package/dist/Arc.js +19 -0
  4. package/dist/Arc.js.map +1 -1
  5. package/dist/Circle.d.ts +7 -0
  6. package/dist/Circle.d.ts.map +1 -1
  7. package/dist/Circle.js +20 -0
  8. package/dist/Circle.js.map +1 -1
  9. package/dist/Geometry.d.ts +16 -0
  10. package/dist/Geometry.d.ts.map +1 -0
  11. package/dist/Geometry.js +37 -0
  12. package/dist/Geometry.js.map +1 -0
  13. package/dist/Line.d.ts +5 -0
  14. package/dist/Line.d.ts.map +1 -1
  15. package/dist/Line.js +15 -0
  16. package/dist/Line.js.map +1 -1
  17. package/dist/Mesh.d.ts +23 -1
  18. package/dist/Mesh.d.ts.map +1 -1
  19. package/dist/Mesh.js +149 -1
  20. package/dist/Mesh.js.map +1 -1
  21. package/dist/NurbsCurve.d.ts +16 -0
  22. package/dist/NurbsCurve.d.ts.map +1 -1
  23. package/dist/NurbsCurve.js +55 -0
  24. package/dist/NurbsCurve.js.map +1 -1
  25. package/dist/NurbsSurface.d.ts +18 -0
  26. package/dist/NurbsSurface.d.ts.map +1 -1
  27. package/dist/NurbsSurface.js +122 -1
  28. package/dist/NurbsSurface.js.map +1 -1
  29. package/dist/Plane.d.ts +7 -1
  30. package/dist/Plane.d.ts.map +1 -1
  31. package/dist/Plane.js +22 -1
  32. package/dist/Plane.js.map +1 -1
  33. package/dist/Point.d.ts +13 -0
  34. package/dist/Point.d.ts.map +1 -1
  35. package/dist/Point.js +27 -0
  36. package/dist/Point.js.map +1 -1
  37. package/dist/PolyCurve.d.ts +35 -0
  38. package/dist/PolyCurve.d.ts.map +1 -1
  39. package/dist/PolyCurve.js +214 -0
  40. package/dist/PolyCurve.js.map +1 -1
  41. package/dist/Polygon.d.ts +6 -0
  42. package/dist/Polygon.d.ts.map +1 -1
  43. package/dist/Polygon.js +16 -0
  44. package/dist/Polygon.js.map +1 -1
  45. package/dist/Polyline.d.ts +5 -0
  46. package/dist/Polyline.d.ts.map +1 -1
  47. package/dist/Polyline.js +20 -0
  48. package/dist/Polyline.js.map +1 -1
  49. package/dist/index.d.ts +3 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/wasm-base64.d.ts +1 -1
  54. package/dist/wasm-base64.d.ts.map +1 -1
  55. package/dist/wasm-base64.js +1 -1
  56. package/dist/wasm-base64.js.map +1 -1
  57. package/package.json +1 -1
  58. package/wasm/README.md +102 -0
  59. package/wasm/okgeometrycore.d.ts +371 -0
  60. package/wasm/okgeometrycore.js +9 -0
  61. package/wasm/okgeometrycore_bg.d.ts +3 -0
  62. package/wasm/okgeometrycore_bg.js +1151 -0
  63. package/wasm/okgeometrycore_bg.wasm +0 -0
  64. package/wasm/okgeometrycore_bg.wasm.d.ts +64 -0
  65. package/wasm/package.json +21 -0
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,8hgdAA8hgd,CAAC"}
1
+ {"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,k11nBAAk11nB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okgeometry-api",
3
- "version": "0.2.7",
3
+ "version": "0.2.10",
4
4
  "description": "Geometry engine API for AEC applications — NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/wasm/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # OkGeometryCore
2
+
3
+ A production-grade geometry engine written in Rust, compiled to WebAssembly. Built for [OkNodes](https://orkestra.online), a visual programming tool for the AEC (Architecture, Engineering, Construction) industry.
4
+
5
+ ## Features
6
+
7
+ ### Mesh Primitives
8
+ - Box, Cylinder, Sphere, Prism, Cone, Torus
9
+
10
+ ### Mesh Operations
11
+ - **Transforms** - translate, rotate, scale, mirror, arbitrary matrix
12
+ - **Extrude** - linear extrusion with optional end caps
13
+ - **Loft** - surface generation between multiple curves
14
+ - **Sweep** - curve along path
15
+ - **Boolean** - union, intersection, subtraction (~95% reliable on manifold meshes)
16
+ - **Subdivision** - Catmull-Clark (quad meshes) and Loop (triangle meshes)
17
+ - **Offset / Shell** - inward/outward mesh offset
18
+ - **Bevel / Chamfer** - flat bevel on all edges or selected edges
19
+ - **Triangulation** - ear clipping and fan triangulation
20
+
21
+ ### Curve Primitives
22
+ - Line, Arc, Circle, Polyline, Polycurve (mixed segments)
23
+
24
+ ### Curve Operations
25
+ - Evaluate, tangent, length, closest point, bounds
26
+ - Chamfer corners, fillet corners (arc), offset polyline
27
+
28
+ ### Intersection
29
+ - Line-Line, Line-Plane, Line-Circle, Circle-Circle
30
+ - Ray-Mesh (BVH-accelerated), closest point on mesh
31
+
32
+ ### Spatial Indexing
33
+ - BVH (Bounding Volume Hierarchy) for O(log n) ray casting and proximity queries
34
+
35
+ ### I/O
36
+ - OBJ import/export
37
+
38
+ ## Architecture
39
+
40
+ ```
41
+ OkNodes (TypeScript)
42
+ | ArrayBuffer / TypedArray
43
+ v
44
+ OkGeometryCore (Rust -> WASM)
45
+ |- math/ Vector3, Matrix4, Quaternion, Plane, Ray, AABB
46
+ |- curves/ Line, Arc, Circle, Polyline, Polycurve
47
+ |- intersection/ Curve-curve intersections
48
+ |- mesh/ Half-edge data structure, primitives
49
+ |- ops/ Boolean, extrude, loft, sweep, subdivide, bevel...
50
+ |- spatial/ BVH, ray casting, closest point
51
+ |- io/ OBJ format
52
+ ```
53
+
54
+ The engine uses an **index-based half-edge mesh** data structure for cache-friendly traversal and easy WASM serialization. All data crosses the WASM boundary as flat typed arrays to minimize overhead.
55
+
56
+ ## Building
57
+
58
+ ### Prerequisites
59
+ - [Rust](https://rustup.rs/)
60
+ - [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)
61
+
62
+ ### Build WASM
63
+ ```bash
64
+ wasm-pack build --target web
65
+ ```
66
+
67
+ ### Run tests
68
+ ```bash
69
+ cargo test
70
+ ```
71
+
72
+ ### Viewer
73
+ The `okgeometry-viewer/` directory contains interactive Three.js viewers for visual verification:
74
+
75
+ ```bash
76
+ # Serve the viewer directory with any static file server, e.g.:
77
+ npx serve okgeometry-viewer
78
+ ```
79
+
80
+ Available viewers:
81
+ - **Curves** - Line, Circle, Arc, Polyline visualization
82
+ - **Intersections** - All curve-curve intersection scenarios
83
+ - **Meshes** - Primitives, wireframe, OBJ import/export
84
+ - **Booleans** - Union, intersection, subtraction with position controls
85
+ - **Subdivision** - Catmull-Clark and Loop with iteration slider
86
+ - **Ray Casting** - Interactive ray cast and closest point queries
87
+ - **Bevel / Chamfer** - Flat bevel on box, cylinder, prism
88
+
89
+ ## Dependencies
90
+
91
+ | Crate | Purpose |
92
+ |-------|---------|
93
+ | `wasm-bindgen` | Rust-WASM interop |
94
+ | `js-sys` / `web-sys` | Browser API access |
95
+ | `robust` | Exact geometric predicates (orient2d, orient3d, incircle) |
96
+ | `spade` | Constrained Delaunay triangulation |
97
+ | `serde` | Serialization |
98
+ | `nalgebra` | Linear algebra (optional feature) |
99
+
100
+ ## License
101
+
102
+ Copyright Mostafa El Ayoubi / Orkestra Online. All rights reserved.
@@ -0,0 +1,371 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Get the length of an arc.
6
+ */
7
+ export function arc_length(radius: number, start_angle: number, end_angle: number): number;
8
+
9
+ /**
10
+ * Evaluate a point on an arc at parameter t ∈ [0,1].
11
+ * Returns [x, y, z].
12
+ */
13
+ export function arc_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, start_angle: number, end_angle: number, t: number): Float64Array;
14
+
15
+ /**
16
+ * Chamfer corners of a polyline by cutting each corner with a straight segment.
17
+ * Input: flat coords [x1,y1,z1, ...], distance from corner to cut.
18
+ * Output: encoded polycurve segments [segment_count, type, ...data, ...]
19
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
20
+ */
21
+ export function chamfer_polycurve(coords: Float64Array, distance: number): Float64Array;
22
+
23
+ /**
24
+ * Get the circumference of a circle.
25
+ */
26
+ export function circle_length(radius: number): number;
27
+
28
+ /**
29
+ * Evaluate a point on a circle at parameter t ∈ [0,1].
30
+ * Returns [x, y, z].
31
+ */
32
+ export function circle_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, t: number): Float64Array;
33
+
34
+ /**
35
+ * Create an arc and return sampled points
36
+ */
37
+ export function create_arc(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, start_angle: number, end_angle: number, samples: number): Float64Array;
38
+
39
+ /**
40
+ * Create a circle and return sampled points
41
+ */
42
+ export function create_circle(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, samples: number): Float64Array;
43
+
44
+ /**
45
+ * Create a line segment and return sampled points
46
+ */
47
+ export function create_line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, samples: number): Float64Array;
48
+
49
+ /**
50
+ * Create a polyline and return the points
51
+ */
52
+ export function create_polyline(coords: Float64Array, samples_per_segment: number): Float64Array;
53
+
54
+ /**
55
+ * Serialize a curve to a list of points for Three.js rendering
56
+ * Returns a flat array of coordinates: [x1, y1, z1, x2, y2, z2, ...]
57
+ */
58
+ export function curve_to_points(curve_type: string, params: Float64Array, samples: number): Float64Array;
59
+
60
+ /**
61
+ * Extrude a circle and return mesh buffers
62
+ */
63
+ export function extrude_circle(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, dx: number, dy: number, dz: number, segments: number, with_caps: boolean): Float64Array;
64
+
65
+ /**
66
+ * Extrude a line segment and return mesh buffers
67
+ */
68
+ export function extrude_line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, dx: number, dy: number, dz: number, segments: number): Float64Array;
69
+
70
+ /**
71
+ * Extrude a polyline and return mesh buffers.
72
+ * Uses the polyline's actual vertices (no resampling) to preserve sharp corners.
73
+ */
74
+ export function extrude_polyline(coords: Float64Array, dx: number, dy: number, dz: number, _segments: number, with_caps: boolean): Float64Array;
75
+
76
+ /**
77
+ * Fillet corners of a polyline with arcs of a given radius.
78
+ * Input: flat coords [x1,y1,z1, ...], radius, plane normal (nx,ny,nz; 0,0,0 for auto).
79
+ * Output: encoded polycurve segments [segment_count, type, ...data, type, ...data, ...]
80
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
81
+ * type 1 = Arc: [cx,cy,cz, nx,ny,nz, radius, start_angle, end_angle]
82
+ */
83
+ export function fillet_polycurve(coords: Float64Array, radius: number, nx: number, ny: number, nz: number): Float64Array;
84
+
85
+ /**
86
+ * Get the length of a line segment.
87
+ */
88
+ export function line_length(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;
89
+
90
+ /**
91
+ * Evaluate a point on a line segment at parameter t ∈ [0,1].
92
+ * Returns [x, y, z].
93
+ */
94
+ export function line_point_at(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, t: number): Float64Array;
95
+
96
+ /**
97
+ * Get the tangent direction of a line segment. Returns [x, y, z].
98
+ */
99
+ export function line_tangent(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): Float64Array;
100
+
101
+ /**
102
+ * Loft between multiple circles
103
+ *
104
+ * # Parameters
105
+ * * `circle_data` - Flat array of circle definitions [cx, cy, cz, nx, ny, nz, radius, ...]
106
+ * * `segments` - Number of segments to sample along each curve
107
+ * * `with_caps` - Whether to create end caps
108
+ *
109
+ * # Returns
110
+ * Mesh buffers for the lofted surface
111
+ */
112
+ export function loft_circles(circle_data: Float64Array, segments: number, with_caps: boolean): Float64Array;
113
+
114
+ /**
115
+ * Loft a NURBS surface through multiple NURBS curves.
116
+ * Input: [num_curves, degree_v, curve1_data..., curve2_data..., ...]
117
+ * Each curve_data: [degree, num_pts, x,y,z,..., w0,w1,..., k0,k1,...]
118
+ * Returns the NurbsSurface data (same format as tessellate input, without u_segs/v_segs).
119
+ */
120
+ export function loft_nurbs_surface(data: Float64Array): Float64Array;
121
+
122
+ /**
123
+ * Loft between multiple polylines
124
+ *
125
+ * # Parameters
126
+ * * `polyline_data` - Flat array where each polyline is prefixed by its point count:
127
+ * [count1, x1, y1, z1, x2, y2, z2, ..., count2, x1, y1, z1, ...]
128
+ * * `segments` - Number of segments to sample along each curve
129
+ * * `with_caps` - Whether to create end caps
130
+ *
131
+ * # Returns
132
+ * Mesh buffers for the lofted surface
133
+ */
134
+ export function loft_polylines(polyline_data: Float64Array, segments: number, with_caps: boolean): Float64Array;
135
+
136
+ /**
137
+ * Make multiple NURBS curves compatible (same knot vectors, same CP count).
138
+ * Input: [curve_count, curve1_data..., curve2_data..., ...]
139
+ * Each curve: [degree, num_cp, cp_xyz..., weights..., knots...]
140
+ * Output: same format with unified curves.
141
+ */
142
+ export function make_nurbs_curves_compatible(curves_data: Float64Array): Float64Array;
143
+
144
+ /**
145
+ * Apply a 4x4 transformation matrix to a mesh.
146
+ * matrix: flat [m00,m01,m02,m03, m10,m11,..., m30,m31,m32,m33] (16 elements, row-major)
147
+ */
148
+ export function mesh_apply_matrix(vertex_count: number, buffer: Float64Array, matrix: Float64Array): Float64Array;
149
+
150
+ /**
151
+ * Perform boolean intersection on two meshes
152
+ */
153
+ export function mesh_boolean_intersection(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
154
+
155
+ /**
156
+ * Perform boolean operation on two meshes
157
+ *
158
+ * # Parameters
159
+ * * `vertex_count_a` - Number of vertices in mesh A
160
+ * * `buffer_a` - Buffer for mesh A [vertices..., indices...]
161
+ * * `vertex_count_b` - Number of vertices in mesh B
162
+ * * `buffer_b` - Buffer for mesh B [vertices..., indices...]
163
+ * * `operation` - Operation type: "union", "intersection", or "subtraction"
164
+ *
165
+ * # Returns
166
+ * Result mesh buffer [vertices..., indices...]
167
+ */
168
+ export function mesh_boolean_operation(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
169
+
170
+ /**
171
+ * Perform boolean subtraction on two meshes (A - B)
172
+ */
173
+ export function mesh_boolean_subtraction(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
174
+
175
+ /**
176
+ * Perform boolean union on two meshes
177
+ */
178
+ export function mesh_boolean_union(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
179
+
180
+ /**
181
+ * Extract boundary (perimeter) edges from a mesh as polylines.
182
+ * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
183
+ */
184
+ export function mesh_boundary_polylines(vertex_count: number, buffer: Float64Array): Float64Array;
185
+
186
+ /**
187
+ * Chamfer all edges of a primitive mesh (flat bevel)
188
+ *
189
+ * # Arguments
190
+ * * `mesh_type` - "box", "cylinder", or "prism"
191
+ * * `params` - Parameters: [width,height,depth] for box, [radius,height,segments] for cylinder/prism
192
+ * * `offset` - Chamfer offset distance
193
+ *
194
+ * # Returns
195
+ * Result mesh buffer [vertexCount, vertices..., indices...]
196
+ */
197
+ export function mesh_chamfer_all_edges(mesh_type: string, params: Float64Array, offset: number): Float64Array;
198
+
199
+ /**
200
+ * Create a box mesh and return buffers
201
+ * Returns [vertices..., indices...]
202
+ */
203
+ export function mesh_create_box(width: number, height: number, depth: number): Float64Array;
204
+
205
+ /**
206
+ * Create a cone mesh and return buffers
207
+ */
208
+ export function mesh_create_cone(radius: number, height: number, segments: number): Float64Array;
209
+
210
+ /**
211
+ * Create a cylinder mesh and return buffers
212
+ */
213
+ export function mesh_create_cylinder(radius: number, height: number, segments: number): Float64Array;
214
+
215
+ /**
216
+ * Create a prism mesh and return buffers
217
+ */
218
+ export function mesh_create_prism(radius: number, height: number, sides: number): Float64Array;
219
+
220
+ /**
221
+ * Create a sphere mesh and return buffers
222
+ */
223
+ export function mesh_create_sphere(radius: number, segments: number, rings: number): Float64Array;
224
+
225
+ /**
226
+ * Export a mesh to OBJ format
227
+ * Takes mesh buffers as input (same format as mesh_to_buffers output)
228
+ * Returns OBJ string
229
+ */
230
+ export function mesh_export_obj(vertex_count: number, buffer: Float64Array): string;
231
+
232
+ /**
233
+ * Get mesh statistics
234
+ * Returns [vertex_count, face_count, edge_count]
235
+ */
236
+ export function mesh_get_stats(vertex_count: number, buffer: Float64Array): Float64Array;
237
+
238
+ /**
239
+ * Import OBJ data and return mesh buffers
240
+ */
241
+ export function mesh_import_obj(obj_data: string): Float64Array;
242
+
243
+ /**
244
+ * Intersect two meshes, returning intersection polyline points.
245
+ * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
246
+ */
247
+ export function mesh_mesh_intersect(va_count: number, buffer_a: Float64Array, vb_count: number, buffer_b: Float64Array): Float64Array;
248
+
249
+ /**
250
+ * Intersect a mesh with a plane, returning polyline points.
251
+ * Input: vertex_count, mesh_buffer..., nx, ny, nz, d
252
+ * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
253
+ */
254
+ export function mesh_plane_intersect(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
255
+
256
+ /**
257
+ * Rotate a mesh around an arbitrary axis and return new buffers
258
+ * Axis is defined by (ax, ay, az), angle in radians
259
+ */
260
+ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: number, ay: number, az: number, angle: number): Float64Array;
261
+
262
+ /**
263
+ * Scale a mesh non-uniformly and return new buffers
264
+ */
265
+ export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
266
+
267
+ /**
268
+ * Translate a mesh by an offset vector and return new buffers
269
+ */
270
+ export function mesh_translate(vertex_count: number, buffer: Float64Array, dx: number, dy: number, dz: number): Float64Array;
271
+
272
+ /**
273
+ * Intersect two NURBS curves.
274
+ * Returns: [num_points, x,y,z, ...]
275
+ */
276
+ export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float64Array): Float64Array;
277
+
278
+ /**
279
+ * Intersect a NURBS curve with a plane.
280
+ * Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
281
+ * Returns: [num_points, x,y,z, x,y,z, ...]
282
+ */
283
+ export function nurbs_curve_plane_intersect(data: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
284
+
285
+ /**
286
+ * Evaluate a NURBS surface at (u, v) parameters.
287
+ * Input format: same as tessellate but last 2 values are u, v instead of u_segs, v_segs
288
+ * Returns [x, y, z]
289
+ */
290
+ export function nurbs_surface_evaluate(data: Float64Array, u: number, v: number): Float64Array;
291
+
292
+ /**
293
+ * Intersect a NURBS surface with a plane.
294
+ * Input: same surface format as tessellate_nurbs_surface, then plane (nx,ny,nz,d) appended.
295
+ * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
296
+ */
297
+ export function nurbs_surface_plane_intersect(surface_data: Float64Array, nx: number, ny: number, nz: number, d: number, tess: number): Float64Array;
298
+
299
+ /**
300
+ * Intersect two NURBS surfaces.
301
+ * Returns polyline buffer.
302
+ */
303
+ export function nurbs_surface_surface_intersect(data_a: Float64Array, data_b: Float64Array, tess: number): Float64Array;
304
+
305
+ /**
306
+ * Offset a polyline by a distance in a given plane.
307
+ * If nx=ny=nz=0, the plane normal is auto-detected.
308
+ * Returns flat [x1,y1,z1, x2,y2,z2, ...] of the offset polyline.
309
+ */
310
+ export function offset_polyline_curve(coords: Float64Array, distance: number, nx: number, ny: number, nz: number): Float64Array;
311
+
312
+ /**
313
+ * Convert a polycurve (Line/Arc segments) to an exact NURBS curve.
314
+ * Input format: [segment_count, type1, ...data1..., type2, ...data2..., ...]
315
+ * type 0 = Line (6 floats: start_xyz, end_xyz)
316
+ * type 1 = Arc (9 floats: center_xyz, normal_xyz, radius, start_angle, end_angle)
317
+ * Output format: [degree, num_cp, cp_x1,y1,z1,..., w1,w2,..., k1,k2,...]
318
+ */
319
+ export function polycurve_to_nurbs(segment_data: Float64Array): Float64Array;
320
+
321
+ /**
322
+ * Get the total length of a polyline.
323
+ * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
324
+ */
325
+ export function polyline_length(coords: Float64Array): number;
326
+
327
+ /**
328
+ * Evaluate a point on a polyline at parameter t ∈ [0,1].
329
+ * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
330
+ * Returns [x, y, z].
331
+ */
332
+ export function polyline_point_at(coords: Float64Array, t: number): Float64Array;
333
+
334
+ /**
335
+ * Sample a NURBS curve.
336
+ * Input: degree, then flat control points [x,y,z,...], then flat weights, then flat knots
337
+ * Format: [degree, num_pts, x0,y0,z0, ..., w0,w1,..., k0,k1,...]
338
+ */
339
+ export function sample_nurbs_curve(data: Float64Array, samples: number): Float64Array;
340
+
341
+ /**
342
+ * Sweep a profile curve along a path curve using exact curve evaluation.
343
+ * profile_data/path_data: encoded curve (see decode_curve)
344
+ * Returns mesh buffers.
345
+ */
346
+ export function sweep_curves(profile_data: Float64Array, path_data: Float64Array, profile_segments: number, path_segments: number, with_caps: boolean): Float64Array;
347
+
348
+ /**
349
+ * Sweep a profile polyline along a path polyline.
350
+ * profile_coords: flat [x,y,z,...] for profile curve
351
+ * path_coords: flat [x,y,z,...] for path curve
352
+ * with_caps: whether to close the ends
353
+ * Returns mesh buffers.
354
+ */
355
+ export function sweep_polylines(profile_coords: Float64Array, path_coords: Float64Array, with_caps: boolean): Float64Array;
356
+
357
+ /**
358
+ * Tessellate a NURBS surface to a mesh buffer.
359
+ * Input format: [degree_u, degree_v, num_u, num_v, ...control_points(flat)..., ...weights(flat)..., ...knots_u..., ...knots_v..., u_segs, v_segs]
360
+ */
361
+ export function tessellate_nurbs_surface(data: Float64Array): Float64Array;
362
+
363
+ /**
364
+ * Simple test function to verify WASM is working
365
+ */
366
+ export function test_wasm(): string;
367
+
368
+ /**
369
+ * Get version info
370
+ */
371
+ export function version(): string;
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./okgeometrycore.d.ts" */
2
+
3
+ import * as wasm from "./okgeometrycore_bg.wasm";
4
+ import { __wbg_set_wasm } from "./okgeometrycore_bg.js";
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ arc_length, arc_point_at, chamfer_polycurve, circle_length, circle_point_at, create_arc, create_circle, create_line, create_polyline, curve_to_points, extrude_circle, extrude_line, extrude_polyline, fillet_polycurve, line_length, line_point_at, line_tangent, loft_circles, loft_nurbs_surface, loft_polylines, make_nurbs_curves_compatible, mesh_apply_matrix, mesh_boolean_intersection, mesh_boolean_operation, mesh_boolean_subtraction, mesh_boolean_union, mesh_boundary_polylines, mesh_chamfer_all_edges, mesh_create_box, mesh_create_cone, mesh_create_cylinder, mesh_create_prism, mesh_create_sphere, mesh_export_obj, mesh_get_stats, mesh_import_obj, mesh_mesh_intersect, mesh_plane_intersect, mesh_rotate, mesh_scale, mesh_translate, nurbs_curve_curve_intersect, nurbs_curve_plane_intersect, nurbs_surface_evaluate, nurbs_surface_plane_intersect, nurbs_surface_surface_intersect, offset_polyline_curve, polycurve_to_nurbs, polyline_length, polyline_point_at, sample_nurbs_curve, sweep_curves, sweep_polylines, tessellate_nurbs_surface, test_wasm, version
9
+ } from "./okgeometrycore_bg.js";
@@ -0,0 +1,3 @@
1
+ /* Auto-generated type declarations for okgeometrycore_bg.js */
2
+ export * from "./okgeometrycore.js";
3
+ export function __wbg_set_wasm(val: any): void;