okgeometry-api 1.2.0 → 1.2.1
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/dist/Line.d.ts +10 -1
- package/dist/Line.d.ts.map +1 -1
- package/dist/Line.js +11 -0
- package/dist/Line.js.map +1 -1
- package/dist/Mesh.d.ts +82 -9
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +329 -26
- package/dist/Mesh.js.map +1 -1
- package/dist/MeshSurface.d.ts +32 -0
- package/dist/MeshSurface.d.ts.map +1 -0
- package/dist/MeshSurface.js +51 -0
- package/dist/MeshSurface.js.map +1 -0
- package/dist/NurbsCurve.d.ts +24 -2
- package/dist/NurbsCurve.d.ts.map +1 -1
- package/dist/NurbsCurve.js +34 -2
- package/dist/NurbsCurve.js.map +1 -1
- package/dist/NurbsSurface.d.ts +9 -1
- package/dist/NurbsSurface.d.ts.map +1 -1
- package/dist/NurbsSurface.js +12 -3
- package/dist/NurbsSurface.js.map +1 -1
- package/dist/PolyCurve.d.ts +21 -3
- package/dist/PolyCurve.d.ts.map +1 -1
- package/dist/PolyCurve.js +82 -38
- package/dist/PolyCurve.js.map +1 -1
- package/dist/Polygon.d.ts +13 -2
- package/dist/Polygon.d.ts.map +1 -1
- package/dist/Polygon.js +21 -3
- package/dist/Polygon.js.map +1 -1
- package/dist/Polyline.d.ts +19 -2
- package/dist/Polyline.d.ts.map +1 -1
- package/dist/Polyline.js +38 -6
- package/dist/Polyline.js.map +1 -1
- package/dist/Surface.d.ts +17 -0
- package/dist/Surface.d.ts.map +1 -0
- package/dist/Surface.js +2 -0
- package/dist/Surface.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/dist/wasm-bindings.d.ts +65 -2
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +100 -2
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +1 -1
- package/src/Line.ts +38 -20
- package/src/Mesh.ts +538 -184
- package/src/MeshSurface.ts +72 -0
- package/src/NurbsCurve.ts +80 -26
- package/src/NurbsSurface.ts +28 -13
- package/src/PolyCurve.ts +157 -85
- package/src/Polygon.ts +34 -4
- package/src/Polyline.ts +74 -24
- package/src/Surface.ts +18 -0
- package/src/index.ts +5 -0
- package/src/types.ts +15 -0
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +43 -2
- package/src/wasm-bindings.js +105 -2
package/src/Line.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ensureInit } from "./engine.js";
|
|
2
|
-
import { Point } from "./Point.js";
|
|
3
|
-
import { Vec3 } from "./Vec3.js";
|
|
4
|
-
import { Mesh } from "./Mesh.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { ensureInit } from "./engine.js";
|
|
2
|
+
import { Point } from "./Point.js";
|
|
3
|
+
import { Vec3 } from "./Vec3.js";
|
|
4
|
+
import { Mesh } from "./Mesh.js";
|
|
5
|
+
import { PolyCurve } from "./PolyCurve.js";
|
|
6
|
+
import { Polyline } from "./Polyline.js";
|
|
7
|
+
import type { Plane } from "./Plane.js";
|
|
8
|
+
import type { CurveOffsetOptions, RotationAxis } from "./types.js";
|
|
9
|
+
import * as wasm from "./wasm-bindings.js";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Immutable line segment defined by start and end points.
|
|
@@ -100,24 +102,40 @@ export class Line {
|
|
|
100
102
|
* @param normal - Reference normal for determining offset direction (default Z axis)
|
|
101
103
|
* @returns New offset line
|
|
102
104
|
*/
|
|
103
|
-
offset(distance: number, normal: Vec3 = Vec3.Z): Line {
|
|
104
|
-
ensureInit();
|
|
105
|
-
const r = wasm.line_offset(
|
|
106
|
-
this.start.x, this.start.y, this.start.z,
|
|
107
|
-
this.end.x, this.end.y, this.end.z,
|
|
105
|
+
offset(distance: number, normal: Vec3 = Vec3.Z): Line {
|
|
106
|
+
ensureInit();
|
|
107
|
+
const r = wasm.line_offset(
|
|
108
|
+
this.start.x, this.start.y, this.start.z,
|
|
109
|
+
this.end.x, this.end.y, this.end.z,
|
|
108
110
|
distance,
|
|
109
111
|
normal.x, normal.y, normal.z,
|
|
110
112
|
);
|
|
111
113
|
return new Line(
|
|
112
114
|
new Point(r[0], r[1], r[2]),
|
|
113
|
-
new Point(r[3], r[4], r[5]),
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
115
|
+
new Point(r[3], r[4], r[5]),
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Thicken this line into a closed PolyCurve suitable for extrusion.
|
|
121
|
+
* When `bothSides` is false, the source line forms one side of the result.
|
|
122
|
+
* When true, the thickness is added on each side of the line.
|
|
123
|
+
*
|
|
124
|
+
* If `normal` is omitted, the kernel will infer a stable fallback plane.
|
|
125
|
+
*/
|
|
126
|
+
thicken(
|
|
127
|
+
distance: number,
|
|
128
|
+
bothSides = false,
|
|
129
|
+
normal?: Vec3,
|
|
130
|
+
options: CurveOffsetOptions = {},
|
|
131
|
+
): PolyCurve {
|
|
132
|
+
return new Polyline([this.start, this.end]).thicken(distance, bothSides, normal, options);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Project this line onto a plane.
|
|
137
|
+
* @param plane - Target plane
|
|
138
|
+
* @param direction - Optional projection direction (default: perpendicular to plane)
|
|
121
139
|
* @returns New projected line
|
|
122
140
|
*/
|
|
123
141
|
projectOntoPlane(plane: Plane, direction?: Vec3): Line {
|