okgeometry-api 0.4.5 → 0.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okgeometry-api",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Geometry engine API for AEC applications — NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -289,6 +289,28 @@ 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
+
292
314
  /**
293
315
  * Evaluate a point on a line segment at parameter t ∈ [0,1].
294
316
  * Returns [x, y, z].
@@ -372,20 +394,20 @@ export function loft_nurbs_surface(data) {
372
394
  * # Parameters
373
395
  * * `polyline_data` - Flat array where each polyline is prefixed by its point count:
374
396
  * [count1, x1, y1, z1, x2, y2, z2, ..., count2, x1, y1, z1, ...]
375
- * * `segments` - Number of segments to sample along each curve
376
- * * `with_caps` - Whether to create end caps
397
+ * * `_segments` - Ignored for polylines (kept for API compat). Points are used directly.
398
+ * * `with_caps` - Whether to create end caps (fan triangulation from center)
377
399
  *
378
400
  * # Returns
379
401
  * Mesh buffers for the lofted surface
380
402
  * @param {Float64Array} polyline_data
381
- * @param {number} segments
403
+ * @param {number} _segments
382
404
  * @param {boolean} with_caps
383
405
  * @returns {Float64Array}
384
406
  */
385
- export function loft_polylines(polyline_data, segments, with_caps) {
407
+ export function loft_polylines(polyline_data, _segments, with_caps) {
386
408
  const ptr0 = passArrayF64ToWasm0(polyline_data, wasm.__wbindgen_malloc);
387
409
  const len0 = WASM_VECTOR_LEN;
388
- const ret = wasm.loft_polylines(ptr0, len0, segments, with_caps);
410
+ const ret = wasm.loft_polylines(ptr0, len0, _segments, with_caps);
389
411
  var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
390
412
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
391
413
  return v2;
@@ -532,6 +554,23 @@ export function mesh_boundary_polylines(vertex_count, buffer) {
532
554
  return v2;
533
555
  }
534
556
 
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
+
535
574
  /**
536
575
  * Chamfer all edges of a primitive mesh (flat bevel)
537
576
  *
@@ -558,6 +597,37 @@ export function mesh_chamfer_all_edges(mesh_type, params, offset) {
558
597
  return v3;
559
598
  }
560
599
 
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
+
561
631
  /**
562
632
  * Create a box mesh and return buffers
563
633
  * Returns [vertices..., indices...]
@@ -629,6 +699,26 @@ export function mesh_create_sphere(radius, segments, rings) {
629
699
  return v1;
630
700
  }
631
701
 
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
+
632
722
  /**
633
723
  * Export a mesh to OBJ format
634
724
  * Takes mesh buffers as input (same format as mesh_to_buffers output)
@@ -652,6 +742,220 @@ export function mesh_export_obj(vertex_count, buffer) {
652
742
  }
653
743
  }
654
744
 
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
+ * Find the best matching coplanar connected face group by normal and optional near-point.
783
+ * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
784
+ * @param {number} vertex_count
785
+ * @param {Float64Array} buffer
786
+ * @param {number} nx
787
+ * @param {number} ny
788
+ * @param {number} nz
789
+ * @param {number} near_x
790
+ * @param {number} near_y
791
+ * @param {number} near_z
792
+ * @param {boolean} use_near_point
793
+ * @returns {Float64Array}
794
+ */
795
+ export function mesh_find_face_group_by_normal(vertex_count, buffer, nx, ny, nz, near_x, near_y, near_z, use_near_point) {
796
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
797
+ const len0 = WASM_VECTOR_LEN;
798
+ const ret = wasm.mesh_find_face_group_by_normal(vertex_count, ptr0, len0, nx, ny, nz, near_x, near_y, near_z, use_near_point);
799
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
800
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
801
+ return v2;
802
+ }
803
+
804
+ /**
805
+ * Find the coplanar connected face group containing triangle_index.
806
+ * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
807
+ * @param {number} vertex_count
808
+ * @param {Float64Array} buffer
809
+ * @param {number} triangle_index
810
+ * @returns {Float64Array}
811
+ */
812
+ export function mesh_find_face_group_by_triangle_index(vertex_count, buffer, triangle_index) {
813
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
814
+ const len0 = WASM_VECTOR_LEN;
815
+ const ret = wasm.mesh_find_face_group_by_triangle_index(vertex_count, ptr0, len0, triangle_index);
816
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
817
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
818
+ return v2;
819
+ }
820
+
821
+ /**
822
+ * Axis-aligned bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
823
+ * @param {number} vertex_count
824
+ * @param {Float64Array} buffer
825
+ * @returns {Float64Array}
826
+ */
827
+ export function mesh_get_bounds(vertex_count, buffer) {
828
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
829
+ const len0 = WASM_VECTOR_LEN;
830
+ const ret = wasm.mesh_get_bounds(vertex_count, ptr0, len0);
831
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
832
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
833
+ return v2;
834
+ }
835
+
836
+ /**
837
+ * Coplanar connected face-group centroid containing a given triangle face index.
838
+ * Output format: [x, y, z] or [] when unavailable.
839
+ * @param {number} vertex_count
840
+ * @param {Float64Array} buffer
841
+ * @param {number} face_index
842
+ * @returns {Float64Array}
843
+ */
844
+ export function mesh_get_coplanar_face_group_centroid(vertex_count, buffer, face_index) {
845
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
846
+ const len0 = WASM_VECTOR_LEN;
847
+ const ret = wasm.mesh_get_coplanar_face_group_centroid(vertex_count, ptr0, len0, face_index);
848
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
849
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
850
+ return v2;
851
+ }
852
+
853
+ /**
854
+ * Edge-connected coplanar triangle indices as [count, i0, i1, ...].
855
+ * @param {number} vertex_count
856
+ * @param {Float64Array} buffer
857
+ * @param {number} face_index
858
+ * @returns {Float64Array}
859
+ */
860
+ export function mesh_get_coplanar_face_indices(vertex_count, buffer, face_index) {
861
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
862
+ const len0 = WASM_VECTOR_LEN;
863
+ const ret = wasm.mesh_get_coplanar_face_indices(vertex_count, ptr0, len0, face_index);
864
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
865
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
866
+ return v2;
867
+ }
868
+
869
+ /**
870
+ * Coplanar connected face region projected to a plane basis.
871
+ * Output format:
872
+ * [faceCount, faceIndex0, faceIndex1, ..., uMin, uMax, vMin, vMax]
873
+ * @param {number} vertex_count
874
+ * @param {Float64Array} buffer
875
+ * @param {number} face_index
876
+ * @param {number} ox
877
+ * @param {number} oy
878
+ * @param {number} oz
879
+ * @param {number} ux
880
+ * @param {number} uy
881
+ * @param {number} uz
882
+ * @param {number} vx
883
+ * @param {number} vy
884
+ * @param {number} vz
885
+ * @param {number} margin_scale
886
+ * @param {number} min_margin
887
+ * @returns {Float64Array}
888
+ */
889
+ 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) {
890
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
891
+ const len0 = WASM_VECTOR_LEN;
892
+ 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);
893
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
894
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
895
+ return v2;
896
+ }
897
+
898
+ /**
899
+ * Unique undirected triangle edges as [edgeCount, v0a, v0b, v1a, v1b, ...].
900
+ * @param {number} vertex_count
901
+ * @param {Float64Array} buffer
902
+ * @returns {Float64Array}
903
+ */
904
+ export function mesh_get_edge_vertex_pairs(vertex_count, buffer) {
905
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
906
+ const len0 = WASM_VECTOR_LEN;
907
+ const ret = wasm.mesh_get_edge_vertex_pairs(vertex_count, ptr0, len0);
908
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
909
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
910
+ return v2;
911
+ }
912
+
913
+ /**
914
+ * Face area.
915
+ * @param {number} vertex_count
916
+ * @param {Float64Array} buffer
917
+ * @param {number} face_index
918
+ * @returns {number}
919
+ */
920
+ export function mesh_get_face_area(vertex_count, buffer, face_index) {
921
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
922
+ const len0 = WASM_VECTOR_LEN;
923
+ const ret = wasm.mesh_get_face_area(vertex_count, ptr0, len0, face_index);
924
+ return ret;
925
+ }
926
+
927
+ /**
928
+ * Face centroid as [x, y, z].
929
+ * @param {number} vertex_count
930
+ * @param {Float64Array} buffer
931
+ * @param {number} face_index
932
+ * @returns {Float64Array}
933
+ */
934
+ export function mesh_get_face_centroid(vertex_count, buffer, face_index) {
935
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
936
+ const len0 = WASM_VECTOR_LEN;
937
+ const ret = wasm.mesh_get_face_centroid(vertex_count, ptr0, len0, face_index);
938
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
939
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
940
+ return v2;
941
+ }
942
+
943
+ /**
944
+ * Face normal as [x, y, z].
945
+ * @param {number} vertex_count
946
+ * @param {Float64Array} buffer
947
+ * @param {number} face_index
948
+ * @returns {Float64Array}
949
+ */
950
+ export function mesh_get_face_normal(vertex_count, buffer, face_index) {
951
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
952
+ const len0 = WASM_VECTOR_LEN;
953
+ const ret = wasm.mesh_get_face_normal(vertex_count, ptr0, len0, face_index);
954
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
955
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
956
+ return v2;
957
+ }
958
+
655
959
  /**
656
960
  * Get mesh statistics
657
961
  * Returns [vertex_count, face_count, edge_count]
@@ -682,6 +986,34 @@ export function mesh_import_obj(obj_data) {
682
986
  return v2;
683
987
  }
684
988
 
989
+ /**
990
+ * Check if triangulated mesh is a closed volume (no welded boundary edges).
991
+ * @param {number} vertex_count
992
+ * @param {Float64Array} buffer
993
+ * @returns {boolean}
994
+ */
995
+ export function mesh_is_closed_volume(vertex_count, buffer) {
996
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
997
+ const len0 = WASM_VECTOR_LEN;
998
+ const ret = wasm.mesh_is_closed_volume(vertex_count, ptr0, len0);
999
+ return ret !== 0;
1000
+ }
1001
+
1002
+ /**
1003
+ * Merge multiple mesh buffers while preserving per-mesh vertex order and index remapping.
1004
+ * Input format: [mesh_count, len1, mesh1..., len2, mesh2..., ...]
1005
+ * @param {Float64Array} mesh_data
1006
+ * @returns {Float64Array}
1007
+ */
1008
+ export function mesh_merge(mesh_data) {
1009
+ const ptr0 = passArrayF64ToWasm0(mesh_data, wasm.__wbindgen_malloc);
1010
+ const len0 = WASM_VECTOR_LEN;
1011
+ const ret = wasm.mesh_merge(ptr0, len0);
1012
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1013
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1014
+ return v2;
1015
+ }
1016
+
685
1017
  /**
686
1018
  * Intersect two meshes, returning intersection polyline points.
687
1019
  * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
@@ -702,6 +1034,23 @@ export function mesh_mesh_intersect(va_count, buffer_a, vb_count, buffer_b) {
702
1034
  return v3;
703
1035
  }
704
1036
 
1037
+ /**
1038
+ * Create a planar patch mesh from boundary points using CDT.
1039
+ * Correctly handles concave polygons (unlike fan triangulation).
1040
+ * Input: flat coordinate array [x1,y1,z1, x2,y2,z2, ...]
1041
+ * Output: mesh buffer [vertexCount, x1,y1,z1,..., i0,i1,i2, ...]
1042
+ * @param {Float64Array} coords
1043
+ * @returns {Float64Array}
1044
+ */
1045
+ export function mesh_patch_from_points(coords) {
1046
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1047
+ const len0 = WASM_VECTOR_LEN;
1048
+ const ret = wasm.mesh_patch_from_points(ptr0, len0);
1049
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1050
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1051
+ return v2;
1052
+ }
1053
+
705
1054
  /**
706
1055
  * Intersect a mesh with a plane, returning polyline points.
707
1056
  * Input: vertex_count, mesh_buffer..., nx, ny, nz, d
@@ -723,6 +1072,95 @@ export function mesh_plane_intersect(vertex_count, buffer, nx, ny, nz, d) {
723
1072
  return v2;
724
1073
  }
725
1074
 
1075
+ /**
1076
+ * Shift closed boolean cutter curve and adjust height.
1077
+ * Returns [height, epsilon, pointCount, x,y,z,...]
1078
+ * @param {Float64Array} coords
1079
+ * @param {boolean} closed
1080
+ * @param {number} nx
1081
+ * @param {number} ny
1082
+ * @param {number} nz
1083
+ * @param {number} height
1084
+ * @returns {Float64Array}
1085
+ */
1086
+ export function mesh_prepare_boolean_cutter_curve(coords, closed, nx, ny, nz, height) {
1087
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1088
+ const len0 = WASM_VECTOR_LEN;
1089
+ const ret = wasm.mesh_prepare_boolean_cutter_curve(ptr0, len0, closed, nx, ny, nz, height);
1090
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1091
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1092
+ return v2;
1093
+ }
1094
+
1095
+ /**
1096
+ * Raycast against mesh and return closest hit.
1097
+ * Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
1098
+ * @param {number} vertex_count
1099
+ * @param {Float64Array} buffer
1100
+ * @param {number} ox
1101
+ * @param {number} oy
1102
+ * @param {number} oz
1103
+ * @param {number} dx
1104
+ * @param {number} dy
1105
+ * @param {number} dz
1106
+ * @param {number} max_distance
1107
+ * @returns {Float64Array}
1108
+ */
1109
+ export function mesh_raycast(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
1110
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1111
+ const len0 = WASM_VECTOR_LEN;
1112
+ const ret = wasm.mesh_raycast(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1113
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1114
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1115
+ return v2;
1116
+ }
1117
+
1118
+ /**
1119
+ * Raycast against mesh and return all hits sorted by distance.
1120
+ * Output: [hitCount, (point, normal, faceIndex, distance)*]
1121
+ * @param {number} vertex_count
1122
+ * @param {Float64Array} buffer
1123
+ * @param {number} ox
1124
+ * @param {number} oy
1125
+ * @param {number} oz
1126
+ * @param {number} dx
1127
+ * @param {number} dy
1128
+ * @param {number} dz
1129
+ * @param {number} max_distance
1130
+ * @returns {Float64Array}
1131
+ */
1132
+ export function mesh_raycast_all(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
1133
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1134
+ const len0 = WASM_VECTOR_LEN;
1135
+ const ret = wasm.mesh_raycast_all(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1136
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1137
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1138
+ return v2;
1139
+ }
1140
+
1141
+ /**
1142
+ * Raycast against many meshes packed as:
1143
+ * [meshCount, meshLen0, meshRaw0..., meshLen1, meshRaw1..., ...]
1144
+ * Output: [hitCount, meshIndex, pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance, ...]
1145
+ * @param {Float64Array} mesh_data
1146
+ * @param {number} ox
1147
+ * @param {number} oy
1148
+ * @param {number} oz
1149
+ * @param {number} dx
1150
+ * @param {number} dy
1151
+ * @param {number} dz
1152
+ * @param {number} max_distance
1153
+ * @returns {Float64Array}
1154
+ */
1155
+ export function mesh_raycast_many(mesh_data, ox, oy, oz, dx, dy, dz, max_distance) {
1156
+ const ptr0 = passArrayF64ToWasm0(mesh_data, wasm.__wbindgen_malloc);
1157
+ const len0 = WASM_VECTOR_LEN;
1158
+ const ret = wasm.mesh_raycast_many(ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1159
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1160
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1161
+ return v2;
1162
+ }
1163
+
726
1164
  /**
727
1165
  * Rotate a mesh around an arbitrary axis and return new buffers
728
1166
  * Axis is defined by (ax, ay, az), angle in radians