okgeometry-api 1.1.22 → 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,12 @@
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";
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
9
  import type { RotationAxis } from "./types.js";
10
- import { parseIntersectionPoints } from "./BufferCodec.js";
11
10
  import * as wasm from "./wasm-bindings.js";
12
11
 
13
12
  /**
@@ -51,24 +50,24 @@ export class NurbsCurve {
51
50
  * @param n - Number of points to generate
52
51
  * @returns Array of n points along the curve
53
52
  */
54
- sample(n: number): Point[] {
55
- ensureInit();
56
- const buf = wasm.sample_nurbs_curve(this._data, n);
57
- const pts: Point[] = [];
58
- for (let i = 0; i < buf.length; i += 3) {
59
- pts.push(new Point(buf[i], buf[i + 1], buf[i + 2]));
60
- }
61
- return pts;
62
- }
63
-
64
- /**
65
- * Check if this NURBS curve is closed.
66
- * @param eps - Tolerance for comparing start and end points
67
- * @returns True if the curve closes on itself
68
- */
69
- isClosed(eps = 1e-10): boolean {
70
- return this.pointAt(0).equals(this.pointAt(1), eps);
71
- }
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
+ }
72
71
 
73
72
  /**
74
73
  * Find intersection points with a plane.
@@ -163,25 +162,25 @@ export class NurbsCurve {
163
162
  * @param samples - Number of sample points (default 64)
164
163
  * @returns Offset polyline approximation
165
164
  */
166
- offset(distance: number, normal?: Vec3, samples = 64): Polyline {
167
- const pts = this.sample(samples);
168
- const pl = new Polyline(pts);
169
- return pl.offset(distance, normal);
170
- }
171
-
172
- /**
173
- * Extrude this closed NURBS curve into a trusted solid suitable for booleans.
174
- * @param direction - Extrusion direction and magnitude
175
- * @param segments - Number of curve samples used for tessellation (default 64)
176
- * @returns Closed mesh solid ready for boolean operations
177
- */
178
- extrudeAsSolid(direction: Vec3, segments = 64): Mesh {
179
- return Mesh.extrudeCurveAsSolid(this, direction, segments);
180
- }
181
-
182
- /**
183
- * Decode a NurbsCurve from WASM flat buffer.
184
- * @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...]
185
184
  * @returns New NurbsCurve instance
186
185
  */
187
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,