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/dist/Mesh.d.ts +52 -0
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +260 -0
- package/dist/Mesh.js.map +1 -1
- package/dist/NurbsCurve.d.ts.map +1 -1
- package/dist/NurbsCurve.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.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 +46 -7
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +86 -7
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +1 -5
- package/src/Mesh.ts +872 -483
- package/src/NurbsCurve.ts +43 -44
- package/src/index.ts +4 -0
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +18 -7
- package/src/wasm-bindings.js +90 -7
package/src/wasm-bindings.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export function arc_length(radius: number, start_angle: number, end_angle: number): number;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Evaluate a point on an arc at parameter t
|
|
10
|
+
* Evaluate a point on an arc at parameter t ∈ [0,1].
|
|
11
11
|
* Returns [x, y, z].
|
|
12
12
|
*/
|
|
13
13
|
export function arc_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, start_angle: number, end_angle: number, t: number): Float64Array;
|
|
@@ -26,7 +26,7 @@ export function chamfer_polycurve(coords: Float64Array, distance: number): Float
|
|
|
26
26
|
export function circle_length(radius: number): number;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Evaluate a point on a circle at parameter t
|
|
29
|
+
* Evaluate a point on a circle at parameter t ∈ [0,1].
|
|
30
30
|
* Returns [x, y, z].
|
|
31
31
|
*/
|
|
32
32
|
export function circle_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, t: number): Float64Array;
|
|
@@ -100,7 +100,7 @@ export function line_length(x1: number, y1: number, z1: number, x2: number, y2:
|
|
|
100
100
|
export function line_offset(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, distance: number, nx: number, ny: number, nz: number): Float64Array;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Evaluate a point on a line segment at parameter t
|
|
103
|
+
* Evaluate a point on a line segment at parameter t ∈ [0,1].
|
|
104
104
|
* Returns [x, y, z].
|
|
105
105
|
*/
|
|
106
106
|
export function line_point_at(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, t: number): Float64Array;
|
|
@@ -216,6 +216,8 @@ export function mesh_boolean_operation_debug(vertex_count_a: number, buffer_a: F
|
|
|
216
216
|
|
|
217
217
|
export function mesh_boolean_port_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
|
|
218
218
|
|
|
219
|
+
export function mesh_boolean_split(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
220
|
+
|
|
219
221
|
/**
|
|
220
222
|
* Perform boolean subtraction on two meshes (A - B)
|
|
221
223
|
*/
|
|
@@ -298,7 +300,7 @@ export function mesh_create_sphere(radius: number, segments: number, rings: numb
|
|
|
298
300
|
|
|
299
301
|
/**
|
|
300
302
|
* Evaluate a point on a mesh surface at parametric coordinates (u, v).
|
|
301
|
-
* Maps u
|
|
303
|
+
* Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
|
|
302
304
|
* then casts a ray perpendicular to the best-fit projection plane.
|
|
303
305
|
* Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
|
|
304
306
|
*/
|
|
@@ -394,8 +396,7 @@ export function mesh_is_closed_volume(vertex_count: number, buffer: Float64Array
|
|
|
394
396
|
|
|
395
397
|
/**
|
|
396
398
|
* Debug helper: run only the isolated direct-port `MeshGL -> Impl -> MeshGL`
|
|
397
|
-
* normalization owner and return a JSON dump
|
|
398
|
-
* comparison against official manifold-3d import/export, not legacy routing.
|
|
399
|
+
* normalization owner and return a JSON dump for local port validation.
|
|
399
400
|
*/
|
|
400
401
|
export function mesh_manifold_port_import_roundtrip_debug(vertex_count: number, buffer: Float64Array, trusted_input: boolean): string;
|
|
401
402
|
|
|
@@ -466,6 +467,12 @@ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: numb
|
|
|
466
467
|
*/
|
|
467
468
|
export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
|
|
468
469
|
|
|
470
|
+
export function mesh_solid_split_plane(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number, operation: string): Float64Array;
|
|
471
|
+
|
|
472
|
+
export function mesh_surface_split(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
473
|
+
|
|
474
|
+
export function mesh_surface_split_plane(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number, operation: string): Float64Array;
|
|
475
|
+
|
|
469
476
|
/**
|
|
470
477
|
* Return welded-edge topology metrics for a triangulated mesh buffer:
|
|
471
478
|
* `[boundary_edges, non_manifold_edges]`.
|
|
@@ -543,7 +550,7 @@ export function polycurve_to_nurbs(segment_data: Float64Array): Float64Array;
|
|
|
543
550
|
export function polyline_length(coords: Float64Array): number;
|
|
544
551
|
|
|
545
552
|
/**
|
|
546
|
-
* Evaluate a point on a polyline at parameter t
|
|
553
|
+
* Evaluate a point on a polyline at parameter t ∈ [0,1].
|
|
547
554
|
* Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
|
|
548
555
|
* Returns [x, y, z].
|
|
549
556
|
*/
|
|
@@ -664,6 +671,7 @@ export interface InitOutput {
|
|
|
664
671
|
readonly mesh_boolean_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
665
672
|
readonly mesh_boolean_operation_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
666
673
|
readonly mesh_boolean_port_triangle_dump: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
674
|
+
readonly mesh_boolean_split: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
667
675
|
readonly mesh_boolean_subtraction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
668
676
|
readonly mesh_boolean_union: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
669
677
|
readonly mesh_boundary_polylines: (a: number, b: number, c: number) => [number, number];
|
|
@@ -706,6 +714,9 @@ export interface InitOutput {
|
|
|
706
714
|
readonly mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
707
715
|
readonly mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
708
716
|
readonly mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
717
|
+
readonly mesh_solid_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
718
|
+
readonly mesh_surface_split: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
719
|
+
readonly mesh_surface_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
709
720
|
readonly mesh_topology_metrics: (a: number, b: number, c: number) => [number, number];
|
|
710
721
|
readonly mesh_topology_metrics_raw: (a: number, b: number, c: number) => [number, number];
|
|
711
722
|
readonly mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
package/src/wasm-bindings.js
CHANGED
|
@@ -13,7 +13,7 @@ export function arc_length(radius, start_angle, end_angle) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Evaluate a point on an arc at parameter t
|
|
16
|
+
* Evaluate a point on an arc at parameter t ∈ [0,1].
|
|
17
17
|
* Returns [x, y, z].
|
|
18
18
|
* @param {number} cx
|
|
19
19
|
* @param {number} cy
|
|
@@ -63,7 +63,7 @@ export function circle_length(radius) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Evaluate a point on a circle at parameter t
|
|
66
|
+
* Evaluate a point on a circle at parameter t ∈ [0,1].
|
|
67
67
|
* Returns [x, y, z].
|
|
68
68
|
* @param {number} cx
|
|
69
69
|
* @param {number} cy
|
|
@@ -314,7 +314,7 @@ export function line_offset(x1, y1, z1, x2, y2, z2, distance, nx, ny, nz) {
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
|
-
* Evaluate a point on a line segment at parameter t
|
|
317
|
+
* Evaluate a point on a line segment at parameter t ∈ [0,1].
|
|
318
318
|
* Returns [x, y, z].
|
|
319
319
|
* @param {number} x1
|
|
320
320
|
* @param {number} y1
|
|
@@ -984,6 +984,27 @@ export function mesh_boolean_port_triangle_dump(vertex_count_a, buffer_a, vertex
|
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
986
|
|
|
987
|
+
/**
|
|
988
|
+
* @param {number} vertex_count_a
|
|
989
|
+
* @param {Float64Array} buffer_a
|
|
990
|
+
* @param {number} vertex_count_b
|
|
991
|
+
* @param {Float64Array} buffer_b
|
|
992
|
+
* @param {string} operation
|
|
993
|
+
* @returns {Float64Array}
|
|
994
|
+
*/
|
|
995
|
+
export function mesh_boolean_split(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
996
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
997
|
+
const len0 = WASM_VECTOR_LEN;
|
|
998
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
999
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1000
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1001
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1002
|
+
const ret = wasm.mesh_boolean_split(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
1003
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1004
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1005
|
+
return v4;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
987
1008
|
/**
|
|
988
1009
|
* Perform boolean subtraction on two meshes (A - B)
|
|
989
1010
|
* @param {number} vertex_count_a
|
|
@@ -1193,7 +1214,7 @@ export function mesh_create_sphere(radius, segments, rings) {
|
|
|
1193
1214
|
|
|
1194
1215
|
/**
|
|
1195
1216
|
* Evaluate a point on a mesh surface at parametric coordinates (u, v).
|
|
1196
|
-
* Maps u
|
|
1217
|
+
* Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
|
|
1197
1218
|
* then casts a ray perpendicular to the best-fit projection plane.
|
|
1198
1219
|
* Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
|
|
1199
1220
|
* @param {number} vertex_count
|
|
@@ -1493,8 +1514,7 @@ export function mesh_is_closed_volume(vertex_count, buffer) {
|
|
|
1493
1514
|
|
|
1494
1515
|
/**
|
|
1495
1516
|
* Debug helper: run only the isolated direct-port `MeshGL -> Impl -> MeshGL`
|
|
1496
|
-
* normalization owner and return a JSON dump
|
|
1497
|
-
* comparison against official manifold-3d import/export, not legacy routing.
|
|
1517
|
+
* normalization owner and return a JSON dump for local port validation.
|
|
1498
1518
|
* @param {number} vertex_count
|
|
1499
1519
|
* @param {Float64Array} buffer
|
|
1500
1520
|
* @param {boolean} trusted_input
|
|
@@ -1757,6 +1777,69 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
|
|
|
1757
1777
|
return v2;
|
|
1758
1778
|
}
|
|
1759
1779
|
|
|
1780
|
+
/**
|
|
1781
|
+
* @param {number} vertex_count
|
|
1782
|
+
* @param {Float64Array} buffer
|
|
1783
|
+
* @param {number} nx
|
|
1784
|
+
* @param {number} ny
|
|
1785
|
+
* @param {number} nz
|
|
1786
|
+
* @param {number} d
|
|
1787
|
+
* @param {string} operation
|
|
1788
|
+
* @returns {Float64Array}
|
|
1789
|
+
*/
|
|
1790
|
+
export function mesh_solid_split_plane(vertex_count, buffer, nx, ny, nz, d, operation) {
|
|
1791
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1792
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1793
|
+
const ptr1 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1794
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1795
|
+
const ret = wasm.mesh_solid_split_plane(vertex_count, ptr0, len0, nx, ny, nz, d, ptr1, len1);
|
|
1796
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1797
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1798
|
+
return v3;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* @param {number} vertex_count_a
|
|
1803
|
+
* @param {Float64Array} buffer_a
|
|
1804
|
+
* @param {number} vertex_count_b
|
|
1805
|
+
* @param {Float64Array} buffer_b
|
|
1806
|
+
* @param {string} operation
|
|
1807
|
+
* @returns {Float64Array}
|
|
1808
|
+
*/
|
|
1809
|
+
export function mesh_surface_split(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
1810
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
1811
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1812
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
1813
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1814
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1815
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1816
|
+
const ret = wasm.mesh_surface_split(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
1817
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1818
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1819
|
+
return v4;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* @param {number} vertex_count
|
|
1824
|
+
* @param {Float64Array} buffer
|
|
1825
|
+
* @param {number} nx
|
|
1826
|
+
* @param {number} ny
|
|
1827
|
+
* @param {number} nz
|
|
1828
|
+
* @param {number} d
|
|
1829
|
+
* @param {string} operation
|
|
1830
|
+
* @returns {Float64Array}
|
|
1831
|
+
*/
|
|
1832
|
+
export function mesh_surface_split_plane(vertex_count, buffer, nx, ny, nz, d, operation) {
|
|
1833
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1834
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1835
|
+
const ptr1 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1836
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1837
|
+
const ret = wasm.mesh_surface_split_plane(vertex_count, ptr0, len0, nx, ny, nz, d, ptr1, len1);
|
|
1838
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1839
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1840
|
+
return v3;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1760
1843
|
/**
|
|
1761
1844
|
* Return welded-edge topology metrics for a triangulated mesh buffer:
|
|
1762
1845
|
* `[boundary_edges, non_manifold_edges]`.
|
|
@@ -1959,7 +2042,7 @@ export function polyline_length(coords) {
|
|
|
1959
2042
|
}
|
|
1960
2043
|
|
|
1961
2044
|
/**
|
|
1962
|
-
* Evaluate a point on a polyline at parameter t
|
|
2045
|
+
* Evaluate a point on a polyline at parameter t ∈ [0,1].
|
|
1963
2046
|
* Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
|
|
1964
2047
|
* Returns [x, y, z].
|
|
1965
2048
|
* @param {Float64Array} coords
|