okgeometry-api 0.4.3 → 0.4.5
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 +100 -4
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +431 -60
- package/dist/Mesh.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mesh-boolean.pool.d.ts +37 -0
- package/dist/mesh-boolean.pool.d.ts.map +1 -0
- package/dist/mesh-boolean.pool.js +336 -0
- package/dist/mesh-boolean.pool.js.map +1 -0
- package/dist/mesh-boolean.protocol.d.ts +85 -0
- package/dist/mesh-boolean.protocol.d.ts.map +1 -0
- package/dist/mesh-boolean.protocol.js +9 -0
- package/dist/mesh-boolean.protocol.js.map +1 -0
- package/dist/mesh-boolean.worker.d.ts +2 -0
- package/dist/mesh-boolean.worker.d.ts.map +1 -0
- package/dist/mesh-boolean.worker.js +105 -0
- package/dist/mesh-boolean.worker.js.map +1 -0
- 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/package.json +1 -1
- package/wasm/okgeometrycore.d.ts +143 -0
- package/wasm/okgeometrycore.js +1784 -7
- package/wasm/okgeometrycore_bg.js +5 -363
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/okgeometrycore_bg.wasm.d.ts +4 -0
- package/wasm/package.json +0 -2
|
@@ -289,28 +289,6 @@ export function line_length(x1, y1, z1, x2, y2, z2) {
|
|
|
289
289
|
return ret;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
/**
|
|
293
|
-
* Offset a line segment perpendicular to line direction relative to reference normal.
|
|
294
|
-
* Returns [startX,startY,startZ,endX,endY,endZ]
|
|
295
|
-
* @param {number} x1
|
|
296
|
-
* @param {number} y1
|
|
297
|
-
* @param {number} z1
|
|
298
|
-
* @param {number} x2
|
|
299
|
-
* @param {number} y2
|
|
300
|
-
* @param {number} z2
|
|
301
|
-
* @param {number} distance
|
|
302
|
-
* @param {number} nx
|
|
303
|
-
* @param {number} ny
|
|
304
|
-
* @param {number} nz
|
|
305
|
-
* @returns {Float64Array}
|
|
306
|
-
*/
|
|
307
|
-
export function line_offset(x1, y1, z1, x2, y2, z2, distance, nx, ny, nz) {
|
|
308
|
-
const ret = wasm.line_offset(x1, y1, z1, x2, y2, z2, distance, nx, ny, nz);
|
|
309
|
-
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
310
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
311
|
-
return v1;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
292
|
/**
|
|
315
293
|
* Evaluate a point on a line segment at parameter t ∈ [0,1].
|
|
316
294
|
* Returns [x, y, z].
|
|
@@ -394,20 +372,20 @@ export function loft_nurbs_surface(data) {
|
|
|
394
372
|
* # Parameters
|
|
395
373
|
* * `polyline_data` - Flat array where each polyline is prefixed by its point count:
|
|
396
374
|
* [count1, x1, y1, z1, x2, y2, z2, ..., count2, x1, y1, z1, ...]
|
|
397
|
-
* * `
|
|
398
|
-
* * `with_caps` - Whether to create end caps
|
|
375
|
+
* * `segments` - Number of segments to sample along each curve
|
|
376
|
+
* * `with_caps` - Whether to create end caps
|
|
399
377
|
*
|
|
400
378
|
* # Returns
|
|
401
379
|
* Mesh buffers for the lofted surface
|
|
402
380
|
* @param {Float64Array} polyline_data
|
|
403
|
-
* @param {number}
|
|
381
|
+
* @param {number} segments
|
|
404
382
|
* @param {boolean} with_caps
|
|
405
383
|
* @returns {Float64Array}
|
|
406
384
|
*/
|
|
407
|
-
export function loft_polylines(polyline_data,
|
|
385
|
+
export function loft_polylines(polyline_data, segments, with_caps) {
|
|
408
386
|
const ptr0 = passArrayF64ToWasm0(polyline_data, wasm.__wbindgen_malloc);
|
|
409
387
|
const len0 = WASM_VECTOR_LEN;
|
|
410
|
-
const ret = wasm.loft_polylines(ptr0, len0,
|
|
388
|
+
const ret = wasm.loft_polylines(ptr0, len0, segments, with_caps);
|
|
411
389
|
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
412
390
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
413
391
|
return v2;
|
|
@@ -554,23 +532,6 @@ export function mesh_boundary_polylines(vertex_count, buffer) {
|
|
|
554
532
|
return v2;
|
|
555
533
|
}
|
|
556
534
|
|
|
557
|
-
/**
|
|
558
|
-
* Coplanar connected face groups.
|
|
559
|
-
* Output format:
|
|
560
|
-
* [groupCount, triCount, tri..., centroidX,centroidY,centroidZ, normalX,normalY,normalZ, ...]
|
|
561
|
-
* @param {number} vertex_count
|
|
562
|
-
* @param {Float64Array} buffer
|
|
563
|
-
* @returns {Float64Array}
|
|
564
|
-
*/
|
|
565
|
-
export function mesh_build_coplanar_connected_face_groups(vertex_count, buffer) {
|
|
566
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
567
|
-
const len0 = WASM_VECTOR_LEN;
|
|
568
|
-
const ret = wasm.mesh_build_coplanar_connected_face_groups(vertex_count, ptr0, len0);
|
|
569
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
570
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
571
|
-
return v2;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
535
|
/**
|
|
575
536
|
* Chamfer all edges of a primitive mesh (flat bevel)
|
|
576
537
|
*
|
|
@@ -597,37 +558,6 @@ export function mesh_chamfer_all_edges(mesh_type, params, offset) {
|
|
|
597
558
|
return v3;
|
|
598
559
|
}
|
|
599
560
|
|
|
600
|
-
/**
|
|
601
|
-
* Compute planar curve normal from ordered points.
|
|
602
|
-
* @param {Float64Array} coords
|
|
603
|
-
* @param {boolean} closed
|
|
604
|
-
* @returns {Float64Array}
|
|
605
|
-
*/
|
|
606
|
-
export function mesh_compute_planar_curve_normal(coords, closed) {
|
|
607
|
-
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
608
|
-
const len0 = WASM_VECTOR_LEN;
|
|
609
|
-
const ret = wasm.mesh_compute_planar_curve_normal(ptr0, len0, closed);
|
|
610
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
611
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
612
|
-
return v2;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Odd/even mesh containment test.
|
|
617
|
-
* @param {number} vertex_count
|
|
618
|
-
* @param {Float64Array} buffer
|
|
619
|
-
* @param {number} px
|
|
620
|
-
* @param {number} py
|
|
621
|
-
* @param {number} pz
|
|
622
|
-
* @returns {boolean}
|
|
623
|
-
*/
|
|
624
|
-
export function mesh_contains_point(vertex_count, buffer, px, py, pz) {
|
|
625
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
626
|
-
const len0 = WASM_VECTOR_LEN;
|
|
627
|
-
const ret = wasm.mesh_contains_point(vertex_count, ptr0, len0, px, py, pz);
|
|
628
|
-
return ret !== 0;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
561
|
/**
|
|
632
562
|
* Create a box mesh and return buffers
|
|
633
563
|
* Returns [vertices..., indices...]
|
|
@@ -699,26 +629,6 @@ export function mesh_create_sphere(radius, segments, rings) {
|
|
|
699
629
|
return v1;
|
|
700
630
|
}
|
|
701
631
|
|
|
702
|
-
/**
|
|
703
|
-
* Evaluate a point on a mesh surface at parametric coordinates (u, v).
|
|
704
|
-
* Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
|
|
705
|
-
* then casts a ray perpendicular to the best-fit projection plane.
|
|
706
|
-
* Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
|
|
707
|
-
* @param {number} vertex_count
|
|
708
|
-
* @param {Float64Array} buffer
|
|
709
|
-
* @param {number} u
|
|
710
|
-
* @param {number} v
|
|
711
|
-
* @returns {Float64Array}
|
|
712
|
-
*/
|
|
713
|
-
export function mesh_evaluate(vertex_count, buffer, u, v) {
|
|
714
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
715
|
-
const len0 = WASM_VECTOR_LEN;
|
|
716
|
-
const ret = wasm.mesh_evaluate(vertex_count, ptr0, len0, u, v);
|
|
717
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
718
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
719
|
-
return v2;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
632
|
/**
|
|
723
633
|
* Export a mesh to OBJ format
|
|
724
634
|
* Takes mesh buffers as input (same format as mesh_to_buffers output)
|
|
@@ -742,163 +652,6 @@ export function mesh_export_obj(vertex_count, buffer) {
|
|
|
742
652
|
}
|
|
743
653
|
}
|
|
744
654
|
|
|
745
|
-
/**
|
|
746
|
-
* Push/pull a planar face set by moving its coplanar connected region.
|
|
747
|
-
* @param {number} vertex_count
|
|
748
|
-
* @param {Float64Array} buffer
|
|
749
|
-
* @param {number} face_index
|
|
750
|
-
* @param {number} distance
|
|
751
|
-
* @returns {Float64Array}
|
|
752
|
-
*/
|
|
753
|
-
export function mesh_extrude_face(vertex_count, buffer, face_index, distance) {
|
|
754
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
755
|
-
const len0 = WASM_VECTOR_LEN;
|
|
756
|
-
const ret = wasm.mesh_extrude_face(vertex_count, ptr0, len0, face_index, distance);
|
|
757
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
758
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
759
|
-
return v2;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Extrude planar curve profile by normal * height.
|
|
764
|
-
* @param {Float64Array} coords
|
|
765
|
-
* @param {number} nx
|
|
766
|
-
* @param {number} ny
|
|
767
|
-
* @param {number} nz
|
|
768
|
-
* @param {number} height
|
|
769
|
-
* @param {boolean} closed
|
|
770
|
-
* @returns {Float64Array}
|
|
771
|
-
*/
|
|
772
|
-
export function mesh_extrude_planar_curve(coords, nx, ny, nz, height, closed) {
|
|
773
|
-
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
774
|
-
const len0 = WASM_VECTOR_LEN;
|
|
775
|
-
const ret = wasm.mesh_extrude_planar_curve(ptr0, len0, nx, ny, nz, height, closed);
|
|
776
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
777
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
778
|
-
return v2;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* Axis-aligned bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
|
|
783
|
-
* @param {number} vertex_count
|
|
784
|
-
* @param {Float64Array} buffer
|
|
785
|
-
* @returns {Float64Array}
|
|
786
|
-
*/
|
|
787
|
-
export function mesh_get_bounds(vertex_count, buffer) {
|
|
788
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
789
|
-
const len0 = WASM_VECTOR_LEN;
|
|
790
|
-
const ret = wasm.mesh_get_bounds(vertex_count, ptr0, len0);
|
|
791
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
792
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
793
|
-
return v2;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Edge-connected coplanar triangle indices as [count, i0, i1, ...].
|
|
798
|
-
* @param {number} vertex_count
|
|
799
|
-
* @param {Float64Array} buffer
|
|
800
|
-
* @param {number} face_index
|
|
801
|
-
* @returns {Float64Array}
|
|
802
|
-
*/
|
|
803
|
-
export function mesh_get_coplanar_face_indices(vertex_count, buffer, face_index) {
|
|
804
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
805
|
-
const len0 = WASM_VECTOR_LEN;
|
|
806
|
-
const ret = wasm.mesh_get_coplanar_face_indices(vertex_count, ptr0, len0, face_index);
|
|
807
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
808
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
809
|
-
return v2;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* Coplanar connected face region projected to a plane basis.
|
|
814
|
-
* Output format:
|
|
815
|
-
* [faceCount, faceIndex0, faceIndex1, ..., uMin, uMax, vMin, vMax]
|
|
816
|
-
* @param {number} vertex_count
|
|
817
|
-
* @param {Float64Array} buffer
|
|
818
|
-
* @param {number} face_index
|
|
819
|
-
* @param {number} ox
|
|
820
|
-
* @param {number} oy
|
|
821
|
-
* @param {number} oz
|
|
822
|
-
* @param {number} ux
|
|
823
|
-
* @param {number} uy
|
|
824
|
-
* @param {number} uz
|
|
825
|
-
* @param {number} vx
|
|
826
|
-
* @param {number} vy
|
|
827
|
-
* @param {number} vz
|
|
828
|
-
* @param {number} margin_scale
|
|
829
|
-
* @param {number} min_margin
|
|
830
|
-
* @returns {Float64Array}
|
|
831
|
-
*/
|
|
832
|
-
export function mesh_get_coplanar_face_region(vertex_count, buffer, face_index, ox, oy, oz, ux, uy, uz, vx, vy, vz, margin_scale, min_margin) {
|
|
833
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
834
|
-
const len0 = WASM_VECTOR_LEN;
|
|
835
|
-
const ret = wasm.mesh_get_coplanar_face_region(vertex_count, ptr0, len0, face_index, ox, oy, oz, ux, uy, uz, vx, vy, vz, margin_scale, min_margin);
|
|
836
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
837
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
838
|
-
return v2;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Unique undirected triangle edges as [edgeCount, v0a, v0b, v1a, v1b, ...].
|
|
843
|
-
* @param {number} vertex_count
|
|
844
|
-
* @param {Float64Array} buffer
|
|
845
|
-
* @returns {Float64Array}
|
|
846
|
-
*/
|
|
847
|
-
export function mesh_get_edge_vertex_pairs(vertex_count, buffer) {
|
|
848
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
849
|
-
const len0 = WASM_VECTOR_LEN;
|
|
850
|
-
const ret = wasm.mesh_get_edge_vertex_pairs(vertex_count, ptr0, len0);
|
|
851
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
852
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
853
|
-
return v2;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Face area.
|
|
858
|
-
* @param {number} vertex_count
|
|
859
|
-
* @param {Float64Array} buffer
|
|
860
|
-
* @param {number} face_index
|
|
861
|
-
* @returns {number}
|
|
862
|
-
*/
|
|
863
|
-
export function mesh_get_face_area(vertex_count, buffer, face_index) {
|
|
864
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
865
|
-
const len0 = WASM_VECTOR_LEN;
|
|
866
|
-
const ret = wasm.mesh_get_face_area(vertex_count, ptr0, len0, face_index);
|
|
867
|
-
return ret;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Face centroid as [x, y, z].
|
|
872
|
-
* @param {number} vertex_count
|
|
873
|
-
* @param {Float64Array} buffer
|
|
874
|
-
* @param {number} face_index
|
|
875
|
-
* @returns {Float64Array}
|
|
876
|
-
*/
|
|
877
|
-
export function mesh_get_face_centroid(vertex_count, buffer, face_index) {
|
|
878
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
879
|
-
const len0 = WASM_VECTOR_LEN;
|
|
880
|
-
const ret = wasm.mesh_get_face_centroid(vertex_count, ptr0, len0, face_index);
|
|
881
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
882
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
883
|
-
return v2;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Face normal as [x, y, z].
|
|
888
|
-
* @param {number} vertex_count
|
|
889
|
-
* @param {Float64Array} buffer
|
|
890
|
-
* @param {number} face_index
|
|
891
|
-
* @returns {Float64Array}
|
|
892
|
-
*/
|
|
893
|
-
export function mesh_get_face_normal(vertex_count, buffer, face_index) {
|
|
894
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
895
|
-
const len0 = WASM_VECTOR_LEN;
|
|
896
|
-
const ret = wasm.mesh_get_face_normal(vertex_count, ptr0, len0, face_index);
|
|
897
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
898
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
899
|
-
return v2;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
655
|
/**
|
|
903
656
|
* Get mesh statistics
|
|
904
657
|
* Returns [vertex_count, face_count, edge_count]
|
|
@@ -929,34 +682,6 @@ export function mesh_import_obj(obj_data) {
|
|
|
929
682
|
return v2;
|
|
930
683
|
}
|
|
931
684
|
|
|
932
|
-
/**
|
|
933
|
-
* Check if triangulated mesh is a closed volume (no welded boundary edges).
|
|
934
|
-
* @param {number} vertex_count
|
|
935
|
-
* @param {Float64Array} buffer
|
|
936
|
-
* @returns {boolean}
|
|
937
|
-
*/
|
|
938
|
-
export function mesh_is_closed_volume(vertex_count, buffer) {
|
|
939
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
940
|
-
const len0 = WASM_VECTOR_LEN;
|
|
941
|
-
const ret = wasm.mesh_is_closed_volume(vertex_count, ptr0, len0);
|
|
942
|
-
return ret !== 0;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
/**
|
|
946
|
-
* Merge multiple mesh buffers while preserving per-mesh vertex order and index remapping.
|
|
947
|
-
* Input format: [mesh_count, len1, mesh1..., len2, mesh2..., ...]
|
|
948
|
-
* @param {Float64Array} mesh_data
|
|
949
|
-
* @returns {Float64Array}
|
|
950
|
-
*/
|
|
951
|
-
export function mesh_merge(mesh_data) {
|
|
952
|
-
const ptr0 = passArrayF64ToWasm0(mesh_data, wasm.__wbindgen_malloc);
|
|
953
|
-
const len0 = WASM_VECTOR_LEN;
|
|
954
|
-
const ret = wasm.mesh_merge(ptr0, len0);
|
|
955
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
956
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
957
|
-
return v2;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
685
|
/**
|
|
961
686
|
* Intersect two meshes, returning intersection polyline points.
|
|
962
687
|
* Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
|
|
@@ -977,23 +702,6 @@ export function mesh_mesh_intersect(va_count, buffer_a, vb_count, buffer_b) {
|
|
|
977
702
|
return v3;
|
|
978
703
|
}
|
|
979
704
|
|
|
980
|
-
/**
|
|
981
|
-
* Create a planar patch mesh from boundary points using CDT.
|
|
982
|
-
* Correctly handles concave polygons (unlike fan triangulation).
|
|
983
|
-
* Input: flat coordinate array [x1,y1,z1, x2,y2,z2, ...]
|
|
984
|
-
* Output: mesh buffer [vertexCount, x1,y1,z1,..., i0,i1,i2, ...]
|
|
985
|
-
* @param {Float64Array} coords
|
|
986
|
-
* @returns {Float64Array}
|
|
987
|
-
*/
|
|
988
|
-
export function mesh_patch_from_points(coords) {
|
|
989
|
-
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
990
|
-
const len0 = WASM_VECTOR_LEN;
|
|
991
|
-
const ret = wasm.mesh_patch_from_points(ptr0, len0);
|
|
992
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
993
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
994
|
-
return v2;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
705
|
/**
|
|
998
706
|
* Intersect a mesh with a plane, returning polyline points.
|
|
999
707
|
* Input: vertex_count, mesh_buffer..., nx, ny, nz, d
|
|
@@ -1015,72 +723,6 @@ export function mesh_plane_intersect(vertex_count, buffer, nx, ny, nz, d) {
|
|
|
1015
723
|
return v2;
|
|
1016
724
|
}
|
|
1017
725
|
|
|
1018
|
-
/**
|
|
1019
|
-
* Shift closed boolean cutter curve and adjust height.
|
|
1020
|
-
* Returns [height, epsilon, pointCount, x,y,z,...]
|
|
1021
|
-
* @param {Float64Array} coords
|
|
1022
|
-
* @param {boolean} closed
|
|
1023
|
-
* @param {number} nx
|
|
1024
|
-
* @param {number} ny
|
|
1025
|
-
* @param {number} nz
|
|
1026
|
-
* @param {number} height
|
|
1027
|
-
* @returns {Float64Array}
|
|
1028
|
-
*/
|
|
1029
|
-
export function mesh_prepare_boolean_cutter_curve(coords, closed, nx, ny, nz, height) {
|
|
1030
|
-
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
1031
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1032
|
-
const ret = wasm.mesh_prepare_boolean_cutter_curve(ptr0, len0, closed, nx, ny, nz, height);
|
|
1033
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1034
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1035
|
-
return v2;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
/**
|
|
1039
|
-
* Raycast against mesh and return closest hit.
|
|
1040
|
-
* Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
|
|
1041
|
-
* @param {number} vertex_count
|
|
1042
|
-
* @param {Float64Array} buffer
|
|
1043
|
-
* @param {number} ox
|
|
1044
|
-
* @param {number} oy
|
|
1045
|
-
* @param {number} oz
|
|
1046
|
-
* @param {number} dx
|
|
1047
|
-
* @param {number} dy
|
|
1048
|
-
* @param {number} dz
|
|
1049
|
-
* @param {number} max_distance
|
|
1050
|
-
* @returns {Float64Array}
|
|
1051
|
-
*/
|
|
1052
|
-
export function mesh_raycast(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
|
|
1053
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1054
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1055
|
-
const ret = wasm.mesh_raycast(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
|
|
1056
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1057
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1058
|
-
return v2;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
* Raycast against mesh and return all hits sorted by distance.
|
|
1063
|
-
* Output: [hitCount, (point, normal, faceIndex, distance)*]
|
|
1064
|
-
* @param {number} vertex_count
|
|
1065
|
-
* @param {Float64Array} buffer
|
|
1066
|
-
* @param {number} ox
|
|
1067
|
-
* @param {number} oy
|
|
1068
|
-
* @param {number} oz
|
|
1069
|
-
* @param {number} dx
|
|
1070
|
-
* @param {number} dy
|
|
1071
|
-
* @param {number} dz
|
|
1072
|
-
* @param {number} max_distance
|
|
1073
|
-
* @returns {Float64Array}
|
|
1074
|
-
*/
|
|
1075
|
-
export function mesh_raycast_all(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
|
|
1076
|
-
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1077
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1078
|
-
const ret = wasm.mesh_raycast_all(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
|
|
1079
|
-
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1080
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1081
|
-
return v2;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
726
|
/**
|
|
1085
727
|
* Rotate a mesh around an arbitrary axis and return new buffers
|
|
1086
728
|
* Axis is defined by (ax, ay, az), angle in radians
|
|
Binary file
|
|
@@ -43,7 +43,10 @@ export const mesh_evaluate: (a: number, b: number, c: number, d: number, e: numb
|
|
|
43
43
|
export const mesh_export_obj: (a: number, b: number, c: number) => [number, number];
|
|
44
44
|
export const mesh_extrude_face: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
45
45
|
export const mesh_extrude_planar_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
46
|
+
export const mesh_find_face_group_by_normal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
47
|
+
export const mesh_find_face_group_by_triangle_index: (a: number, b: number, c: number, d: number) => [number, number];
|
|
46
48
|
export const mesh_get_bounds: (a: number, b: number, c: number) => [number, number];
|
|
49
|
+
export const mesh_get_coplanar_face_group_centroid: (a: number, b: number, c: number, d: number) => [number, number];
|
|
47
50
|
export const mesh_get_coplanar_face_indices: (a: number, b: number, c: number, d: number) => [number, number];
|
|
48
51
|
export const mesh_get_coplanar_face_region: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => [number, number];
|
|
49
52
|
export const mesh_get_edge_vertex_pairs: (a: number, b: number, c: number) => [number, number];
|
|
@@ -60,6 +63,7 @@ export const mesh_plane_intersect: (a: number, b: number, c: number, d: number,
|
|
|
60
63
|
export const mesh_prepare_boolean_cutter_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
61
64
|
export const mesh_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
62
65
|
export const mesh_raycast_all: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
66
|
+
export const mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
63
67
|
export const mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
64
68
|
export const mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
65
69
|
export const mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
package/wasm/package.json
CHANGED
|
@@ -9,13 +9,11 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"okgeometrycore_bg.wasm",
|
|
11
11
|
"okgeometrycore.js",
|
|
12
|
-
"okgeometrycore_bg.js",
|
|
13
12
|
"okgeometrycore.d.ts"
|
|
14
13
|
],
|
|
15
14
|
"main": "okgeometrycore.js",
|
|
16
15
|
"types": "okgeometrycore.d.ts",
|
|
17
16
|
"sideEffects": [
|
|
18
|
-
"./okgeometrycore.js",
|
|
19
17
|
"./snippets/*"
|
|
20
18
|
]
|
|
21
19
|
}
|