okgeometry-api 1.1.23 → 1.2.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/src/NurbsCurve.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ensureInit } from "./engine.js";
2
2
  import { Point } from "./Point.js";
3
- import { Vec3 } from "./Vec3.js";
4
- import { Plane } from "./Plane.js";
5
- import { Mesh } from "./Mesh.js";
6
- import { Polyline } from "./Polyline.js";
7
- import type { Line } from "./Line.js";
8
- import type { Arc } from "./Arc.js";
9
- import type { RotationAxis } from "./types.js";
10
- import * as wasm from "./wasm-bindings.js";
3
+ import { Vec3 } from "./Vec3.js";
4
+ import { Plane } from "./Plane.js";
5
+ import { Mesh } from "./Mesh.js";
6
+ import { Polyline } from "./Polyline.js";
7
+ import type { Line } from "./Line.js";
8
+ import type { Arc } from "./Arc.js";
9
+ import type { RotationAxis } from "./types.js";
10
+ import * as wasm from "./wasm-bindings.js";
11
11
 
12
12
  /**
13
13
  * Non-Uniform Rational B-Spline (NURBS) curve backed by WASM.
@@ -50,24 +50,24 @@ export class NurbsCurve {
50
50
  * @param n - Number of points to generate
51
51
  * @returns Array of n points along the curve
52
52
  */
53
- sample(n: number): Point[] {
54
- ensureInit();
55
- const buf = wasm.sample_nurbs_curve(this._data, n);
56
- const pts: Point[] = [];
57
- for (let i = 0; i < buf.length; i += 3) {
58
- pts.push(new Point(buf[i], buf[i + 1], buf[i + 2]));
59
- }
60
- return pts;
61
- }
62
-
63
- /**
64
- * Check if this NURBS curve is closed.
65
- * @param eps - Tolerance for comparing start and end points
66
- * @returns True if the curve closes on itself
67
- */
68
- isClosed(eps = 1e-10): boolean {
69
- return this.pointAt(0).equals(this.pointAt(1), eps);
70
- }
53
+ sample(n: number): Point[] {
54
+ ensureInit();
55
+ const buf = wasm.sample_nurbs_curve(this._data, n);
56
+ const pts: Point[] = [];
57
+ for (let i = 0; i < buf.length; i += 3) {
58
+ pts.push(new Point(buf[i], buf[i + 1], buf[i + 2]));
59
+ }
60
+ return pts;
61
+ }
62
+
63
+ /**
64
+ * Check if this NURBS curve is closed.
65
+ * @param eps - Tolerance for comparing start and end points
66
+ * @returns True if the curve closes on itself
67
+ */
68
+ isClosed(eps = 1e-10): boolean {
69
+ return this.pointAt(0).equals(this.pointAt(1), eps);
70
+ }
71
71
 
72
72
  /**
73
73
  * Find intersection points with a plane.
@@ -162,25 +162,25 @@ export class NurbsCurve {
162
162
  * @param samples - Number of sample points (default 64)
163
163
  * @returns Offset polyline approximation
164
164
  */
165
- offset(distance: number, normal?: Vec3, samples = 64): Polyline {
166
- const pts = this.sample(samples);
167
- const pl = new Polyline(pts);
168
- return pl.offset(distance, normal);
169
- }
170
-
171
- /**
172
- * Extrude this closed NURBS curve into a trusted solid suitable for booleans.
173
- * @param direction - Extrusion direction and magnitude
174
- * @param segments - Number of curve samples used for tessellation (default 64)
175
- * @returns Closed mesh solid ready for boolean operations
176
- */
177
- extrudeAsSolid(direction: Vec3, segments = 64): Mesh {
178
- return Mesh.extrudeCurveAsSolid(this, direction, segments);
179
- }
180
-
181
- /**
182
- * Decode a NurbsCurve from WASM flat buffer.
183
- * @param data - Buffer in format [degree, num_cp, xyz..., w..., k...]
165
+ offset(distance: number, normal?: Vec3, samples = 64): Polyline {
166
+ const pts = this.sample(samples);
167
+ const pl = new Polyline(pts);
168
+ return pl.offset(distance, normal);
169
+ }
170
+
171
+ /**
172
+ * Extrude this closed NURBS curve into a trusted solid suitable for booleans.
173
+ * @param direction - Extrusion direction and magnitude
174
+ * @param segments - Number of curve samples used for tessellation (default 64)
175
+ * @returns Closed mesh solid ready for boolean operations
176
+ */
177
+ extrudeAsSolid(direction: Vec3, segments = 64): Mesh {
178
+ return Mesh.extrudeCurveAsSolid(this, direction, segments);
179
+ }
180
+
181
+ /**
182
+ * Decode a NurbsCurve from WASM flat buffer.
183
+ * @param data - Buffer in format [degree, num_cp, xyz..., w..., k...]
184
184
  * @returns New NurbsCurve instance
185
185
  */
186
186
  static fromData(data: Float64Array | number[]): NurbsCurve {
package/src/index.ts CHANGED
@@ -46,6 +46,10 @@ export type {
46
46
  MeshBooleanReproError,
47
47
  MeshBooleanReproPayload,
48
48
  MeshBooleanReproOptions,
49
+ MeshSplitResult,
50
+ MeshPlaneSplitResult,
51
+ MeshPlaneSplitOptions,
52
+ MeshCurveSplitOptions,
49
53
  MeshDebugBounds,
50
54
  MeshDebugRayHit,
51
55
  MeshDebugSummary,