okgeometry-api 1.26.1 → 1.27.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.
Files changed (99) hide show
  1. package/dist/Arc.js +1 -1
  2. package/dist/Arc.js.map +1 -1
  3. package/dist/Brep.js +1 -1
  4. package/dist/Brep.js.map +1 -1
  5. package/dist/Circle.js +1 -1
  6. package/dist/Circle.js.map +1 -1
  7. package/dist/Line.js +1 -1
  8. package/dist/Line.js.map +1 -1
  9. package/dist/Mesh.d.ts +41 -0
  10. package/dist/Mesh.d.ts.map +1 -1
  11. package/dist/Mesh.js +235 -21
  12. package/dist/Mesh.js.map +1 -1
  13. package/dist/MeshSurface.js +1 -1
  14. package/dist/MeshSurface.js.map +1 -1
  15. package/dist/NurbsCurve.js +1 -1
  16. package/dist/NurbsCurve.js.map +1 -1
  17. package/dist/NurbsSurface.js +1 -1
  18. package/dist/NurbsSurface.js.map +1 -1
  19. package/dist/PolyCurve.js +1 -1
  20. package/dist/PolyCurve.js.map +1 -1
  21. package/dist/Polyline.js +1 -1
  22. package/dist/Polyline.js.map +1 -1
  23. package/dist/Ray.js +1 -1
  24. package/dist/Ray.js.map +1 -1
  25. package/dist/SculptSession.js +1 -1
  26. package/dist/SculptSession.js.map +1 -1
  27. package/dist/engine-threaded.d.ts +2 -0
  28. package/dist/engine-threaded.d.ts.map +1 -0
  29. package/dist/engine-threaded.js +33 -0
  30. package/dist/engine-threaded.js.map +1 -0
  31. package/dist/engine.d.ts +21 -0
  32. package/dist/engine.d.ts.map +1 -1
  33. package/dist/engine.js +42 -0
  34. package/dist/engine.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/mesh-boolean.pool.d.ts +23 -1
  40. package/dist/mesh-boolean.pool.d.ts.map +1 -1
  41. package/dist/mesh-boolean.pool.js +97 -12
  42. package/dist/mesh-boolean.pool.js.map +1 -1
  43. package/dist/mesh-boolean.protocol.d.ts +21 -1
  44. package/dist/mesh-boolean.protocol.d.ts.map +1 -1
  45. package/dist/mesh-boolean.protocol.js.map +1 -1
  46. package/dist/mesh-boolean.worker.d.ts.map +1 -1
  47. package/dist/mesh-boolean.worker.js +94 -1
  48. package/dist/mesh-boolean.worker.js.map +1 -1
  49. package/dist/wasm-active.d.ts +20 -0
  50. package/dist/wasm-active.d.ts.map +1 -0
  51. package/dist/wasm-active.js +26 -0
  52. package/dist/wasm-active.js.map +1 -0
  53. package/dist/wasm-base64-threaded.d.ts +2 -0
  54. package/dist/wasm-base64-threaded.d.ts.map +1 -0
  55. package/dist/wasm-base64-threaded.js +3 -0
  56. package/dist/wasm-base64-threaded.js.map +1 -0
  57. package/dist/wasm-base64.d.ts +1 -1
  58. package/dist/wasm-base64.d.ts.map +1 -1
  59. package/dist/wasm-base64.js +1 -1
  60. package/dist/wasm-base64.js.map +1 -1
  61. package/dist/wasm-bindings-threaded.d.ts +2664 -0
  62. package/dist/wasm-bindings-threaded.d.ts.map +1 -0
  63. package/dist/wasm-bindings-threaded.js +5008 -0
  64. package/dist/wasm-bindings-threaded.js.map +1 -0
  65. package/dist/wasm-bindings.d.ts +130 -0
  66. package/dist/wasm-bindings.d.ts.map +1 -1
  67. package/dist/wasm-bindings.js +208 -0
  68. package/dist/wasm-bindings.js.map +1 -1
  69. package/dist/workerHelpers-threaded.d.ts +2 -0
  70. package/dist/workerHelpers-threaded.d.ts.map +1 -0
  71. package/dist/workerHelpers-threaded.js +100 -0
  72. package/dist/workerHelpers-threaded.js.map +1 -0
  73. package/package.json +8 -3
  74. package/src/Arc.ts +117 -117
  75. package/src/Brep.ts +1 -1
  76. package/src/Circle.ts +166 -166
  77. package/src/Line.ts +171 -171
  78. package/src/Mesh.ts +300 -45
  79. package/src/MeshSurface.ts +1 -1
  80. package/src/NurbsCurve.ts +655 -655
  81. package/src/NurbsSurface.ts +721 -721
  82. package/src/PolyCurve.ts +203 -203
  83. package/src/Polyline.ts +316 -316
  84. package/src/Ray.ts +90 -90
  85. package/src/SculptSession.ts +377 -377
  86. package/src/engine-threaded.ts +39 -0
  87. package/src/engine.ts +46 -0
  88. package/src/index.ts +1 -1
  89. package/src/mesh-boolean.pool.ts +208 -86
  90. package/src/mesh-boolean.protocol.ts +44 -1
  91. package/src/mesh-boolean.worker.ts +170 -56
  92. package/src/wasm-active.ts +31 -0
  93. package/src/wasm-base64-threaded.ts +2 -0
  94. package/src/wasm-base64.ts +1 -1
  95. package/src/wasm-bindings-threaded.d.ts +1989 -0
  96. package/src/wasm-bindings-threaded.js +5235 -0
  97. package/src/wasm-bindings.d.ts +104 -0
  98. package/src/wasm-bindings.js +225 -0
  99. package/src/workerHelpers-threaded.js +107 -0
package/src/Ray.ts CHANGED
@@ -1,90 +1,90 @@
1
- import { ensureInit } from "./engine.js";
2
- import { Point } from "./Point.js";
3
- import { Vec3 } from "./Vec3.js";
4
- import * as wasm from "./wasm-bindings.js";
5
-
6
- /**
7
- * 3D ray defined by origin and direction.
8
- * Parametric form: point(t) = origin + t * direction
9
- */
10
- export class Ray {
11
- constructor(
12
- public readonly origin: Point,
13
- public readonly direction: Vec3
14
- ) {}
15
-
16
- /**
17
- * Create a ray from origin and direction, normalizing the direction.
18
- * Returns null if direction is zero-length.
19
- */
20
- static fromOriginDirection(origin: Point, direction: Vec3): Ray | null {
21
- const normalized = direction.normalize();
22
- if (normalized.length() < 1e-10) return null;
23
- return new Ray(origin, normalized);
24
- }
25
-
26
- /**
27
- * Get point along the ray at parameter t.
28
- * Returns origin + t * direction
29
- */
30
- pointAt(t: number): Point {
31
- ensureInit();
32
- const r = wasm.ray_point_at(
33
- this.origin.x, this.origin.y, this.origin.z,
34
- this.direction.x, this.direction.y, this.direction.z,
35
- t
36
- );
37
- return new Point(r[0], r[1], r[2]);
38
- }
39
-
40
- /**
41
- * Find the parameter t for the closest point on the ray to a given point.
42
- * The closest point is at: origin + t * direction
43
- * Note: t can be negative if the closest point is "behind" the ray origin,
44
- * but closestPoint() clamps t >= 0.
45
- */
46
- closestPointParameter(point: Point): number {
47
- ensureInit();
48
- return wasm.ray_closest_point_parameter(
49
- this.origin.x, this.origin.y, this.origin.z,
50
- this.direction.x, this.direction.y, this.direction.z,
51
- point.x, point.y, point.z
52
- );
53
- }
54
-
55
- /**
56
- * Find the closest point on the ray to a given point.
57
- * The result is clamped to the ray (t >= 0), so if the closest
58
- * point would be "behind" the origin, returns the origin.
59
- */
60
- closestPoint(point: Point): Point {
61
- ensureInit();
62
- const r = wasm.ray_closest_point(
63
- this.origin.x, this.origin.y, this.origin.z,
64
- this.direction.x, this.direction.y, this.direction.z,
65
- point.x, point.y, point.z
66
- );
67
- return new Point(r[0], r[1], r[2]);
68
- }
69
-
70
- /**
71
- * Compute the distance from this ray to a point.
72
- * This is the perpendicular distance from the ray to the point,
73
- * clamped so that the closest point is on the ray (t >= 0).
74
- */
75
- distanceToPoint(point: Point): number {
76
- ensureInit();
77
- return wasm.ray_distance_to_point(
78
- this.origin.x, this.origin.y, this.origin.z,
79
- this.direction.x, this.direction.y, this.direction.z,
80
- point.x, point.y, point.z
81
- );
82
- }
83
-
84
- /**
85
- * Translate the ray by an offset vector.
86
- */
87
- translate(offset: Vec3): Ray {
88
- return new Ray(this.origin.add(offset), this.direction);
89
- }
90
- }
1
+ import { ensureInit } from "./engine.js";
2
+ import { Point } from "./Point.js";
3
+ import { Vec3 } from "./Vec3.js";
4
+ import { wasm } from "./wasm-active.js";
5
+
6
+ /**
7
+ * 3D ray defined by origin and direction.
8
+ * Parametric form: point(t) = origin + t * direction
9
+ */
10
+ export class Ray {
11
+ constructor(
12
+ public readonly origin: Point,
13
+ public readonly direction: Vec3
14
+ ) {}
15
+
16
+ /**
17
+ * Create a ray from origin and direction, normalizing the direction.
18
+ * Returns null if direction is zero-length.
19
+ */
20
+ static fromOriginDirection(origin: Point, direction: Vec3): Ray | null {
21
+ const normalized = direction.normalize();
22
+ if (normalized.length() < 1e-10) return null;
23
+ return new Ray(origin, normalized);
24
+ }
25
+
26
+ /**
27
+ * Get point along the ray at parameter t.
28
+ * Returns origin + t * direction
29
+ */
30
+ pointAt(t: number): Point {
31
+ ensureInit();
32
+ const r = wasm.ray_point_at(
33
+ this.origin.x, this.origin.y, this.origin.z,
34
+ this.direction.x, this.direction.y, this.direction.z,
35
+ t
36
+ );
37
+ return new Point(r[0], r[1], r[2]);
38
+ }
39
+
40
+ /**
41
+ * Find the parameter t for the closest point on the ray to a given point.
42
+ * The closest point is at: origin + t * direction
43
+ * Note: t can be negative if the closest point is "behind" the ray origin,
44
+ * but closestPoint() clamps t >= 0.
45
+ */
46
+ closestPointParameter(point: Point): number {
47
+ ensureInit();
48
+ return wasm.ray_closest_point_parameter(
49
+ this.origin.x, this.origin.y, this.origin.z,
50
+ this.direction.x, this.direction.y, this.direction.z,
51
+ point.x, point.y, point.z
52
+ );
53
+ }
54
+
55
+ /**
56
+ * Find the closest point on the ray to a given point.
57
+ * The result is clamped to the ray (t >= 0), so if the closest
58
+ * point would be "behind" the origin, returns the origin.
59
+ */
60
+ closestPoint(point: Point): Point {
61
+ ensureInit();
62
+ const r = wasm.ray_closest_point(
63
+ this.origin.x, this.origin.y, this.origin.z,
64
+ this.direction.x, this.direction.y, this.direction.z,
65
+ point.x, point.y, point.z
66
+ );
67
+ return new Point(r[0], r[1], r[2]);
68
+ }
69
+
70
+ /**
71
+ * Compute the distance from this ray to a point.
72
+ * This is the perpendicular distance from the ray to the point,
73
+ * clamped so that the closest point is on the ray (t >= 0).
74
+ */
75
+ distanceToPoint(point: Point): number {
76
+ ensureInit();
77
+ return wasm.ray_distance_to_point(
78
+ this.origin.x, this.origin.y, this.origin.z,
79
+ this.direction.x, this.direction.y, this.direction.z,
80
+ point.x, point.y, point.z
81
+ );
82
+ }
83
+
84
+ /**
85
+ * Translate the ray by an offset vector.
86
+ */
87
+ translate(offset: Vec3): Ray {
88
+ return new Ray(this.origin.add(offset), this.direction);
89
+ }
90
+ }