okgeometry-api 1.5.0 → 1.9.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.
@@ -5,18 +5,18 @@ import { Plane } from "./Plane.js";
5
5
  import { Mesh } from "./Mesh.js";
6
6
  import { Polyline } from "./Polyline.js";
7
7
  import { Polygon } from "./Polygon.js";
8
- import { Line } from "./Line.js";
9
- import { Arc } from "./Arc.js";
10
- import { PolyCurve } from "./PolyCurve.js";
11
- import { NurbsCurve } from "./NurbsCurve.js";
12
- import type { Surface } from "./Surface.js";
13
- import type { LoftableCurve, RotationAxis } from "./types.js";
14
- import {
15
- decodePointResult,
16
- decodeVec3Result,
17
- parsePolylineBuffer as parsePolylineBuf,
18
- } from "./BufferCodec.js";
19
- import * as wasm from "./wasm-bindings.js";
8
+ import { Line } from "./Line.js";
9
+ import { Arc } from "./Arc.js";
10
+ import { PolyCurve } from "./PolyCurve.js";
11
+ import { NurbsCurve } from "./NurbsCurve.js";
12
+ import type { Surface } from "./Surface.js";
13
+ import type { LoftableCurve, RotationAxis } from "./types.js";
14
+ import {
15
+ decodePointResult,
16
+ decodeVec3Result,
17
+ parsePolylineBuffer as parsePolylineBuf,
18
+ } from "./BufferCodec.js";
19
+ import * as wasm from "./wasm-bindings.js";
20
20
 
21
21
  /**
22
22
  * Non-Uniform Rational B-Spline (NURBS) surface backed by WASM.
@@ -24,7 +24,7 @@ import * as wasm from "./wasm-bindings.js";
24
24
  *
25
25
  * WASM data format: [degree_u, degree_v, num_u, num_v, ...cp(flat)..., ...weights..., ...knots_u..., ...knots_v...]
26
26
  */
27
- export class NurbsSurface implements Surface {
27
+ export class NurbsSurface implements Surface {
28
28
  private _data: Float64Array;
29
29
 
30
30
  /**
@@ -87,21 +87,21 @@ export class NurbsSurface implements Surface {
87
87
  * @param v - Parameter in V direction [0, 1]
88
88
  * @returns Point on surface at (u, v)
89
89
  */
90
- evaluate(u: number, v: number): Point {
91
- ensureInit();
92
- return decodePointResult(wasm.nurbs_surface_evaluate(this._data, u, v));
93
- }
94
-
95
- /**
96
- * Evaluate the unit normal on the surface at parameters (u, v).
97
- * @param u - Parameter in U direction [0, 1]
98
- * @param v - Parameter in V direction [0, 1]
99
- * @returns Unit surface normal at (u, v)
100
- */
101
- normal(u: number, v: number): Vec3 {
102
- ensureInit();
103
- return decodeVec3Result(wasm.nurbs_surface_normal(this._data, u, v));
104
- }
90
+ evaluate(u: number, v: number): Point {
91
+ ensureInit();
92
+ return decodePointResult(wasm.nurbs_surface_evaluate(this._data, u, v));
93
+ }
94
+
95
+ /**
96
+ * Evaluate the unit normal on the surface at parameters (u, v).
97
+ * @param u - Parameter in U direction [0, 1]
98
+ * @param v - Parameter in V direction [0, 1]
99
+ * @returns Unit surface normal at (u, v)
100
+ */
101
+ normal(u: number, v: number): Vec3 {
102
+ ensureInit();
103
+ return decodeVec3Result(wasm.nurbs_surface_normal(this._data, u, v));
104
+ }
105
105
 
106
106
  /**
107
107
  * Tessellate this surface into a triangle mesh.
@@ -188,20 +188,20 @@ export class NurbsSurface implements Surface {
188
188
  for (const p of c.controlPoints) { compatParts.push(p.x, p.y, p.z); }
189
189
  for (const w of c.weights) { compatParts.push(w); }
190
190
  for (const k of c.knots) { compatParts.push(k); }
191
- }
192
- const compatBuf = wasm.make_nurbs_curves_compatible(new Float64Array(compatParts));
193
- if (compatBuf.length > 0) {
194
- const count = Number(compatBuf[0] ?? 0);
195
- const decoded: NurbsCurve[] = [];
196
- let off = 1;
197
- for (let i = 0; i < count; i++) {
198
- const deg = Number(compatBuf[off] ?? 0);
199
- const n = Number(compatBuf[off + 1] ?? 0);
200
- const curveLen = 2 + n * 3 + n + (n + deg + 1);
201
- decoded.push(NurbsCurve.fromData(compatBuf.slice(off, off + curveLen)));
202
- off += curveLen;
203
- }
204
- loftCurves = decoded;
191
+ }
192
+ const compatBuf = wasm.make_nurbs_curves_compatible(new Float64Array(compatParts));
193
+ if (compatBuf.length > 0) {
194
+ const count = Number(compatBuf[0] ?? 0);
195
+ const decoded: NurbsCurve[] = [];
196
+ let off = 1;
197
+ for (let i = 0; i < count; i++) {
198
+ const deg = Number(compatBuf[off] ?? 0);
199
+ const n = Number(compatBuf[off + 1] ?? 0);
200
+ const curveLen = 2 + n * 3 + n + (n + deg + 1);
201
+ decoded.push(NurbsCurve.fromData(compatBuf.slice(off, off + curveLen)));
202
+ off += curveLen;
203
+ }
204
+ loftCurves = decoded;
205
205
  }
206
206
  }
207
207
  }
@@ -214,22 +214,31 @@ export class NurbsSurface implements Surface {
214
214
  for (const p of pts) { parts.push(p.x, p.y, p.z); }
215
215
  for (const w of c.weights) { parts.push(w); }
216
216
  for (const k of c.knots) { parts.push(k); }
217
- }
218
- const buf = wasm.loft_nurbs_surface(new Float64Array(parts));
219
- if (buf.length < 4) throw new Error("NurbsSurface loft failed");
220
- const degU = Number(buf[0] ?? 0);
221
- const degV2 = Number(buf[1] ?? 0);
222
- const numU = Number(buf[2] ?? 0);
223
- const numV = Number(buf[3] ?? 0);
224
- const totalPts = numU * numV;
225
- const expectedLen = 4 + totalPts * 3 + totalPts + (degU + numU + 1) + (degV2 + numV + 1);
226
- if (buf.length < expectedLen) throw new Error("NurbsSurface loft: buffer too short");
217
+ }
218
+ const buf = wasm.loft_nurbs_surface(new Float64Array(parts));
219
+ if (buf.length < 4) throw new Error("NurbsSurface loft failed");
220
+ return NurbsSurface.fromData(buf);
221
+ }
222
+
223
+ /**
224
+ * Decode a NurbsSurface from the standard WASM surface buffer
225
+ * [degU, degV, numU, numV, cps..., weights..., knotsU..., knotsV...].
226
+ */
227
+ static fromData(buf: Float64Array | number[]): NurbsSurface {
228
+ if (buf.length < 4) throw new Error("NurbsSurface.fromData: buffer too short");
229
+ const degU = Number(buf[0] ?? 0);
230
+ const degV = Number(buf[1] ?? 0);
231
+ const numU = Number(buf[2] ?? 0);
232
+ const numV = Number(buf[3] ?? 0);
233
+ const totalPts = numU * numV;
234
+ const expectedLen = 4 + totalPts * 3 + totalPts + (degU + numU + 1) + (degV + numV + 1);
235
+ if (buf.length < expectedLen) throw new Error("NurbsSurface.fromData: buffer too short");
227
236
  let idx = 4;
228
237
  const cp: Point[][] = [];
229
238
  for (let u = 0; u < numU; u++) {
230
239
  const row: Point[] = [];
231
240
  for (let v = 0; v < numV; v++) {
232
- row.push(new Point(buf[idx], buf[idx + 1], buf[idx + 2]));
241
+ row.push(new Point(Number(buf[idx]), Number(buf[idx + 1]), Number(buf[idx + 2])));
233
242
  idx += 3;
234
243
  }
235
244
  cp.push(row);
@@ -237,16 +246,312 @@ export class NurbsSurface implements Surface {
237
246
  const weights: number[][] = [];
238
247
  for (let u = 0; u < numU; u++) {
239
248
  const row: number[] = [];
240
- for (let v = 0; v < numV; v++) { row.push(buf[idx++]); }
249
+ for (let v = 0; v < numV; v++) { row.push(Number(buf[idx++])); }
241
250
  weights.push(row);
242
- }
243
- const knotsULen = degU + numU + 1;
244
- const knotsVLen = degV2 + numV + 1;
245
- const knotsU: number[] = Array.from(buf.slice(idx, idx + knotsULen), (value) => Number(value));
246
- idx += knotsULen;
247
- const knotsV: number[] = Array.from(buf.slice(idx, idx + knotsVLen), (value) => Number(value));
248
- return new NurbsSurface(degU, degV2, cp, weights, knotsU, knotsV);
249
- }
251
+ }
252
+ const knotsULen = degU + numU + 1;
253
+ const knotsVLen = degV + numV + 1;
254
+ const knotsU: number[] = Array.from(buf.slice(idx, idx + knotsULen), (value) => Number(value));
255
+ idx += knotsULen;
256
+ const knotsV: number[] = Array.from(buf.slice(idx, idx + knotsVLen), (value) => Number(value));
257
+ return new NurbsSurface(degU, degV, cp, weights, knotsU, knotsV);
258
+ }
259
+
260
+ /** Raw WASM surface buffer (advanced use). */
261
+ get data(): Float64Array {
262
+ return this._data;
263
+ }
264
+
265
+ // ── Analytic queries ──
266
+
267
+ /**
268
+ * Analytic surface derivatives at (u, v) — exact rational derivatives
269
+ * (Piegl & Tiller A4.4), with respect to the normalized [0,1] parameters.
270
+ */
271
+ derivatives(u: number, v: number): {
272
+ point: Point;
273
+ du: Vec3;
274
+ dv: Vec3;
275
+ duu: Vec3;
276
+ duv: Vec3;
277
+ dvv: Vec3;
278
+ } {
279
+ ensureInit();
280
+ const r = wasm.nurbs_surface_derivatives(this._data, u, v);
281
+ if (r.length < 18) throw new Error("NurbsSurface.derivatives failed");
282
+ const vec = (i: number) => new Vec3(r[i], r[i + 1], r[i + 2]);
283
+ return {
284
+ point: new Point(r[0], r[1], r[2]),
285
+ du: vec(3),
286
+ dv: vec(6),
287
+ duu: vec(9),
288
+ duv: vec(12),
289
+ dvv: vec(15),
290
+ };
291
+ }
292
+
293
+ /**
294
+ * Principal curvatures and curvature invariants at (u, v), from the exact
295
+ * first/second fundamental forms.
296
+ */
297
+ curvature(u: number, v: number): {
298
+ k1: number;
299
+ k2: number;
300
+ gaussian: number;
301
+ mean: number;
302
+ normal: Vec3;
303
+ } {
304
+ ensureInit();
305
+ const r = wasm.nurbs_surface_curvature(this._data, u, v);
306
+ if (r.length < 7) throw new Error("NurbsSurface.curvature failed");
307
+ return {
308
+ k1: r[0],
309
+ k2: r[1],
310
+ gaussian: r[2],
311
+ mean: r[3],
312
+ normal: new Vec3(r[4], r[5], r[6]),
313
+ };
314
+ }
315
+
316
+ /**
317
+ * Closest point on the surface to `p` (Newton point inversion with grid
318
+ * seeding). Returns normalized (u, v) and the surface point.
319
+ */
320
+ closestPoint(p: Point): { u: number; v: number; point: Point } {
321
+ ensureInit();
322
+ const r = wasm.nurbs_surface_closest_point(this._data, p.x, p.y, p.z);
323
+ if (r.length < 5) throw new Error("NurbsSurface.closestPoint failed");
324
+ return { u: r[0], v: r[1], point: new Point(r[2], r[3], r[4]) };
325
+ }
326
+
327
+ // ── Iso-curves (exact rational extraction) ──
328
+
329
+ /**
330
+ * Exact iso-parametric curve running along the U direction at constant v.
331
+ * Rational surfaces yield exact rational curves (weights preserved).
332
+ * @param v - Normalized v parameter [0, 1]
333
+ */
334
+ isoCurveU(v: number): NurbsCurve {
335
+ ensureInit();
336
+ const buf = wasm.nurbs_surface_iso_curve(this._data, v, true);
337
+ if (buf.length < 2) throw new Error("NurbsSurface.isoCurveU failed");
338
+ return NurbsCurve.fromData(buf);
339
+ }
340
+
341
+ /**
342
+ * Exact iso-parametric curve running along the V direction at constant u.
343
+ * @param u - Normalized u parameter [0, 1]
344
+ */
345
+ isoCurveV(u: number): NurbsCurve {
346
+ ensureInit();
347
+ const buf = wasm.nurbs_surface_iso_curve(this._data, u, false);
348
+ if (buf.length < 2) throw new Error("NurbsSurface.isoCurveV failed");
349
+ return NurbsCurve.fromData(buf);
350
+ }
351
+
352
+ // ── Exact refinement / editing ──
353
+
354
+ /**
355
+ * Exact knot insertion at normalized parameter t (shape-preserving; adds a
356
+ * row/column of control points for finer editing).
357
+ */
358
+ insertKnot(direction: "u" | "v", t: number, times = 1): NurbsSurface {
359
+ ensureInit();
360
+ const buf = wasm.nurbs_surface_insert_knot(this._data, direction === "u", t, times);
361
+ if (buf.length < 4) throw new Error("NurbsSurface.insertKnot failed");
362
+ return NurbsSurface.fromData(buf);
363
+ }
364
+
365
+ /**
366
+ * Exact degree elevation by `t` in one direction (shape-preserving).
367
+ */
368
+ elevateDegree(direction: "u" | "v", t = 1): NurbsSurface {
369
+ ensureInit();
370
+ const buf = wasm.nurbs_surface_elevate_degree(this._data, direction === "u", t);
371
+ if (buf.length < 4) throw new Error("NurbsSurface.elevateDegree failed");
372
+ return NurbsSurface.fromData(buf);
373
+ }
374
+
375
+ /**
376
+ * Exact split at normalized parameter t. Returns [lower, upper].
377
+ */
378
+ split(direction: "u" | "v", t: number): [NurbsSurface, NurbsSurface] {
379
+ ensureInit();
380
+ const buf = wasm.nurbs_surface_split(this._data, direction === "u", t);
381
+ if (buf.length < 2) throw new Error("NurbsSurface.split failed");
382
+ const lenA = Number(buf[0]);
383
+ const a = buf.slice(1, 1 + lenA);
384
+ const lenB = Number(buf[1 + lenA]);
385
+ const b = buf.slice(2 + lenA, 2 + lenA + lenB);
386
+ return [NurbsSurface.fromData(a), NurbsSurface.fromData(b)];
387
+ }
388
+
389
+ /**
390
+ * Exact sub-patch over normalized parameter ranges.
391
+ */
392
+ extractRegion(u0: number, u1: number, v0: number, v1: number): NurbsSurface {
393
+ ensureInit();
394
+ const buf = wasm.nurbs_surface_extract_region(this._data, u0, u1, v0, v1);
395
+ if (buf.length < 4) throw new Error("NurbsSurface.extractRegion failed");
396
+ return NurbsSurface.fromData(buf);
397
+ }
398
+
399
+ /**
400
+ * Return a copy with one control point (and optionally its weight) replaced —
401
+ * the primitive for interactive control-point editing.
402
+ */
403
+ withControlPoint(i: number, j: number, point: Point, weight?: number): NurbsSurface {
404
+ if (i < 0 || i >= this.controlPoints.length || j < 0 || j >= (this.controlPoints[0]?.length ?? 0)) {
405
+ throw new Error(`Control point index (${i}, ${j}) out of range`);
406
+ }
407
+ const cps = this.controlPoints.map((row, ri) =>
408
+ row.map((p, rj) => (ri === i && rj === j ? point : p))
409
+ );
410
+ const weights = this.weights.map((row, ri) =>
411
+ row.map((w, rj) => (ri === i && rj === j && weight !== undefined ? weight : w))
412
+ );
413
+ return new NurbsSurface(this.degreeU, this.degreeV, cps, weights, this.knotsU, this.knotsV);
414
+ }
415
+
416
+ // ── Tessellation ──
417
+
418
+ /**
419
+ * Curvature-adaptive tessellation: flat regions stay coarse, curved regions
420
+ * refine until the chordal `tolerance` is met.
421
+ */
422
+ tessellateAdaptive(tolerance: number, maxSegmentsPerSpan = 64): Mesh {
423
+ ensureInit();
424
+ const buf = wasm.nurbs_surface_tessellate_adaptive(this._data, tolerance, maxSegmentsPerSpan);
425
+ if (buf.length < 1) throw new Error("NurbsSurface.tessellateAdaptive failed");
426
+ return Mesh.fromBuffer(buf);
427
+ }
428
+
429
+ /**
430
+ * Convert to a mesh sheet for boolean/trim operations with meshes
431
+ * (adaptive tessellation at the given chordal tolerance). A sheet
432
+ * intersected with a closed solid via `Mesh.intersect`/`Mesh.subtract`
433
+ * trims to the portion inside/outside that solid.
434
+ */
435
+ toMesh(tolerance = 0.01): Mesh {
436
+ return this.tessellateAdaptive(tolerance);
437
+ }
438
+
439
+ /**
440
+ * Display-ready render tessellation computed in one kernel pass: a
441
+ * twist-aware adaptive grid with ANALYTIC surface normals, plus feature
442
+ * edges only where the surface genuinely has them (boundary iso-lines,
443
+ * kinked C0 knot lines, kinked closed seams — never quad diagonals).
444
+ *
445
+ * Prefer this over `tessellateAdaptive(...).buildRenderBuffers(...)` for
446
+ * displaying a NURBS surface: the mesh path reconstructs normals from
447
+ * triangle geometry and flags spurious crease edges on anisotropic grids.
448
+ *
449
+ * `positions`/`normals` are non-indexed, three floats per vertex;
450
+ * `featureEdges` holds two endpoints (six floats) per segment.
451
+ */
452
+ tessellateRender(
453
+ tolerance: number,
454
+ maxSegmentsPerSpan = 64,
455
+ creaseAngleDeg = 30
456
+ ): { positions: Float32Array; normals: Float32Array; featureEdges: Float32Array } {
457
+ ensureInit();
458
+ const r: Float32Array = wasm.nurbs_surface_tessellate_render(
459
+ this._data,
460
+ tolerance,
461
+ maxSegmentsPerSpan,
462
+ creaseAngleDeg
463
+ );
464
+ const vertexCount = Math.max(0, Math.floor(r[0] ?? 0));
465
+ const posStart = 1;
466
+ const norStart = posStart + vertexCount * 3;
467
+ const edgeCountIndex = norStart + vertexCount * 3;
468
+ const edgeCount = Math.max(0, Math.floor(r[edgeCountIndex] ?? 0));
469
+ const edgeStart = edgeCountIndex + 1;
470
+ return {
471
+ positions: r.subarray(posStart, posStart + vertexCount * 3),
472
+ normals: r.subarray(norStart, norStart + vertexCount * 3),
473
+ featureEdges: r.subarray(edgeStart, edgeStart + edgeCount * 6),
474
+ };
475
+ }
476
+
477
+ // ── Exact constructors ──
478
+
479
+ /**
480
+ * Exact surface of revolution: revolve a profile curve around an axis.
481
+ * The circular direction is exactly rational (true circles, not approximations).
482
+ * @param angle - Revolve angle in radians (up to 2π)
483
+ */
484
+ static revolve(profile: NurbsCurve, origin: Point, axis: Vec3, angle: number): NurbsSurface {
485
+ ensureInit();
486
+ const buf = wasm.nurbs_surface_revolve(
487
+ profile.data,
488
+ origin.x, origin.y, origin.z,
489
+ axis.x, axis.y, axis.z,
490
+ angle
491
+ );
492
+ if (buf.length < 4) throw new Error("NurbsSurface.revolve failed");
493
+ return NurbsSurface.fromData(buf);
494
+ }
495
+
496
+ /** Exact extruded (translational) surface from a profile curve. */
497
+ static extrudeCurve(profile: NurbsCurve, direction: Vec3): NurbsSurface {
498
+ ensureInit();
499
+ const buf = wasm.nurbs_surface_extrude(profile.data, direction.x, direction.y, direction.z);
500
+ if (buf.length < 4) throw new Error("NurbsSurface.extrudeCurve failed");
501
+ return NurbsSurface.fromData(buf);
502
+ }
503
+
504
+ /** Exact ruled surface between two curves (degrees/knots unified automatically). */
505
+ static ruled(a: NurbsCurve, b: NurbsCurve): NurbsSurface {
506
+ ensureInit();
507
+ const buf = wasm.nurbs_surface_ruled(a.data, b.data);
508
+ if (buf.length < 4) throw new Error("NurbsSurface.ruled failed");
509
+ return NurbsSurface.fromData(buf);
510
+ }
511
+
512
+ /** Exact rational cylinder side surface. */
513
+ static cylinder(base: Point, axis: Vec3, radius: number, height: number): NurbsSurface {
514
+ ensureInit();
515
+ const buf = wasm.nurbs_surface_primitive(
516
+ "cylinder",
517
+ new Float64Array([base.x, base.y, base.z, axis.x, axis.y, axis.z, radius, height])
518
+ );
519
+ if (buf.length < 4) throw new Error("NurbsSurface.cylinder failed");
520
+ return NurbsSurface.fromData(buf);
521
+ }
522
+
523
+ /** Exact rational sphere surface. */
524
+ static sphere(center: Point, radius: number): NurbsSurface {
525
+ ensureInit();
526
+ const buf = wasm.nurbs_surface_primitive(
527
+ "sphere",
528
+ new Float64Array([center.x, center.y, center.z, radius])
529
+ );
530
+ if (buf.length < 4) throw new Error("NurbsSurface.sphere failed");
531
+ return NurbsSurface.fromData(buf);
532
+ }
533
+
534
+ /** Exact rational cone/frustum side surface (radius1 may be 0). */
535
+ static cone(base: Point, axis: Vec3, radius0: number, radius1: number, height: number): NurbsSurface {
536
+ ensureInit();
537
+ const buf = wasm.nurbs_surface_primitive(
538
+ "cone",
539
+ new Float64Array([base.x, base.y, base.z, axis.x, axis.y, axis.z, radius0, radius1, height])
540
+ );
541
+ if (buf.length < 4) throw new Error("NurbsSurface.cone failed");
542
+ return NurbsSurface.fromData(buf);
543
+ }
544
+
545
+ /** Exact rational torus surface (axis +Z through center). */
546
+ static torus(center: Point, major: number, minor: number): NurbsSurface {
547
+ ensureInit();
548
+ const buf = wasm.nurbs_surface_primitive(
549
+ "torus",
550
+ new Float64Array([center.x, center.y, center.z, major, minor])
551
+ );
552
+ if (buf.length < 4) throw new Error("NurbsSurface.torus failed");
553
+ return NurbsSurface.fromData(buf);
554
+ }
250
555
 
251
556
  /** Encode to WASM format */
252
557
  private static encode(
package/src/index.ts CHANGED
@@ -1,68 +1,77 @@
1
- // Core initialization
2
- export { init, isInitialized } from "./engine.js";
3
-
4
- // Shared types and utilities
5
- export type {
6
- SweepableCurve,
7
- LoftableCurve,
8
- RotationAxis,
9
- CurveSegment,
10
- CurveOffsetJoinStyle,
11
- CurveOffsetOptions,
12
- } from "./types.js";
13
- export { CurveTypeCode, SegmentTypeCode } from "./types.js";
14
- export {
15
- pointsToCoords,
16
- coordsToPoints,
17
- parsePolylineBuffer,
18
- parseIntersectionPoints,
19
- } from "./BufferCodec.js";
20
-
21
- // Primitive types
22
- export { Vec3 } from "./Vec3.js";
23
- export { Point } from "./Point.js";
24
- export { Plane } from "./Plane.js";
25
- export { Ray } from "./Ray.js";
26
-
27
- // Curve types
28
- export { Line } from "./Line.js";
29
- export { Circle } from "./Circle.js";
30
- export { Arc } from "./Arc.js";
31
- export { Polyline } from "./Polyline.js";
32
- export { Polygon } from "./Polygon.js";
33
- export { PolyCurve } from "./PolyCurve.js";
34
- export { NurbsCurve } from "./NurbsCurve.js";
35
- export { NurbsSurface } from "./NurbsSurface.js";
36
- export { MeshSurface } from "./MeshSurface.js";
37
- export type { Surface } from "./Surface.js";
38
-
39
- // Mesh and operations
40
- export { Mesh, MeshBooleanExecutionError } from "./Mesh.js";
41
- export type {
42
- MeshBooleanOperation,
43
- MeshBooleanDebugProbeId,
44
- MeshBooleanDebugOptions,
45
- MeshBooleanDebugProbe,
46
- MeshBooleanDebugProbeSummary,
47
- MeshBooleanDebugReport,
48
- MeshBooleanReproOperand,
49
- MeshBooleanReproResult,
50
- MeshBooleanReproError,
51
- MeshBooleanReproPayload,
52
- MeshBooleanReproOptions,
53
- MeshSplitResult,
54
- MeshPlaneSplitResult,
55
- MeshPlaneSplitOptions,
56
- MeshCurveSplitOptions,
57
- MeshPlanarFace,
58
- MeshDebugBounds,
59
- MeshDebugRayHit,
60
- MeshDebugSummary,
61
- MeshBooleanLimits,
62
- MeshBooleanOptions,
63
- MeshBooleanAsyncOptions,
64
- MeshBooleanErrorCode,
65
- MeshBooleanErrorPayload,
66
- MeshBooleanProgressEvent,
67
- } from "./Mesh.js";
68
- export { intersect } from "./Geometry.js";
1
+ // Core initialization
2
+ export { init, isInitialized } from "./engine.js";
3
+
4
+ // Shared types and utilities
5
+ export type {
6
+ SweepableCurve,
7
+ LoftableCurve,
8
+ RotationAxis,
9
+ CurveSegment,
10
+ CurveOffsetJoinStyle,
11
+ CurveOffsetOptions,
12
+ } from "./types.js";
13
+ export { CurveTypeCode, SegmentTypeCode } from "./types.js";
14
+ export {
15
+ pointsToCoords,
16
+ coordsToPoints,
17
+ parsePolylineBuffer,
18
+ parseIntersectionPoints,
19
+ } from "./BufferCodec.js";
20
+
21
+ // Primitive types
22
+ export { Vec3 } from "./Vec3.js";
23
+ export { Point } from "./Point.js";
24
+ export { Plane } from "./Plane.js";
25
+ export { Ray } from "./Ray.js";
26
+
27
+ // Curve types
28
+ export { Line } from "./Line.js";
29
+ export { Circle } from "./Circle.js";
30
+ export { Arc } from "./Arc.js";
31
+ export { Polyline } from "./Polyline.js";
32
+ export { Polygon } from "./Polygon.js";
33
+ export { PolyCurve } from "./PolyCurve.js";
34
+ export { NurbsCurve } from "./NurbsCurve.js";
35
+ export { NurbsSurface } from "./NurbsSurface.js";
36
+ export { MeshSurface } from "./MeshSurface.js";
37
+ export type { Surface } from "./Surface.js";
38
+
39
+ // Boundary representation
40
+ export { Brep } from "./Brep.js";
41
+ export type {
42
+ BrepInfo,
43
+ BrepValidationReport,
44
+ BrepBooleanOptions,
45
+ BrepParametricBooleanOptions,
46
+ } from "./Brep.js";
47
+
48
+ // Mesh and operations
49
+ export { Mesh, MeshBooleanExecutionError } from "./Mesh.js";
50
+ export type {
51
+ MeshBooleanOperation,
52
+ MeshBooleanDebugProbeId,
53
+ MeshBooleanDebugOptions,
54
+ MeshBooleanDebugProbe,
55
+ MeshBooleanDebugProbeSummary,
56
+ MeshBooleanDebugReport,
57
+ MeshBooleanReproOperand,
58
+ MeshBooleanReproResult,
59
+ MeshBooleanReproError,
60
+ MeshBooleanReproPayload,
61
+ MeshBooleanReproOptions,
62
+ MeshSplitResult,
63
+ MeshPlaneSplitResult,
64
+ MeshPlaneSplitOptions,
65
+ MeshCurveSplitOptions,
66
+ MeshPlanarFace,
67
+ MeshDebugBounds,
68
+ MeshDebugRayHit,
69
+ MeshDebugSummary,
70
+ MeshBooleanLimits,
71
+ MeshBooleanOptions,
72
+ MeshBooleanAsyncOptions,
73
+ MeshBooleanErrorCode,
74
+ MeshBooleanErrorPayload,
75
+ MeshBooleanProgressEvent,
76
+ } from "./Mesh.js";
77
+ export { intersect } from "./Geometry.js";