@woosh/meep-engine 2.138.20 → 2.140.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 (584) hide show
  1. package/package.json +1 -1
  2. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
  3. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
  4. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
  5. package/src/core/collection/PairUint32Map.d.ts +100 -0
  6. package/src/core/collection/PairUint32Map.d.ts.map +1 -0
  7. package/src/core/collection/PairUint32Map.js +321 -0
  8. package/src/core/collection/Uint32Map.d.ts +119 -0
  9. package/src/core/collection/Uint32Map.d.ts.map +1 -0
  10. package/src/core/collection/Uint32Map.js +345 -0
  11. package/src/core/collection/array/array_shuffle.d.ts +10 -3
  12. package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
  13. package/src/core/collection/array/array_shuffle.js +27 -22
  14. package/src/core/collection/heap/FibonacciHeap.d.ts +195 -0
  15. package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -0
  16. package/src/core/collection/heap/FibonacciHeap.js +586 -0
  17. package/src/core/collection/heap/Uint32Heap.js +1 -1
  18. package/src/core/collection/heap/Uint32Heap4.d.ts +169 -0
  19. package/src/core/collection/heap/Uint32Heap4.d.ts.map +1 -0
  20. package/src/core/collection/heap/Uint32Heap4.js +490 -0
  21. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +30 -0
  22. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
  23. package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +93 -0
  24. package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts +27 -0
  25. package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts.map +1 -0
  26. package/src/core/geom/3d/line/line3_closest_points_segment_segment.js +88 -0
  27. package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
  28. package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
  29. package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
  30. package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
  31. package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
  32. package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
  33. package/src/core/geom/3d/shape/BoxShape3D.d.ts +61 -0
  34. package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -0
  35. package/src/core/geom/3d/shape/BoxShape3D.js +158 -0
  36. package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +11 -0
  37. package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
  38. package/src/core/geom/3d/shape/CapsuleShape3D.js +12 -0
  39. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
  40. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
  41. package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
  42. package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
  43. package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
  44. package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
  45. package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
  46. package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
  47. package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
  48. package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
  49. package/src/core/geom/3d/shape/Triangle3D.js +318 -0
  50. package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
  51. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +37 -9
  52. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
  53. package/src/core/geom/3d/shape/UnitCubeShape3D.js +45 -98
  54. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +10 -0
  55. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
  56. package/src/core/geom/3d/shape/UnitSphereShape3D.js +11 -0
  57. package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
  58. package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
  59. package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
  60. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts +61 -0
  61. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -0
  62. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +148 -0
  63. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts +39 -0
  64. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts.map +1 -0
  65. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.js +147 -0
  66. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts +15 -0
  67. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts.map +1 -0
  68. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.js +22 -0
  69. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts +2 -0
  70. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts.map +1 -0
  71. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +671 -0
  72. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
  73. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
  74. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
  75. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts +26 -0
  76. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts.map +1 -0
  77. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.js +222 -0
  78. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts +34 -0
  79. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts.map +1 -0
  80. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.js +146 -0
  81. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts +36 -0
  82. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts.map +1 -0
  83. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.js +232 -0
  84. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts +33 -0
  85. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts.map +1 -0
  86. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.js +255 -0
  87. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts +68 -0
  88. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -0
  89. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +387 -0
  90. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +35 -0
  91. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -0
  92. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +140 -0
  93. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +31 -0
  94. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -0
  95. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +97 -0
  96. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts +32 -0
  97. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts.map +1 -0
  98. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.js +66 -0
  99. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +41 -0
  100. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
  101. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +124 -13
  102. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts +134 -0
  103. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts.map +1 -1
  104. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +276 -3
  105. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +17 -0
  106. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -0
  107. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +135 -0
  108. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts +14 -0
  109. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts.map +1 -0
  110. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.js +177 -0
  111. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts.map +1 -1
  112. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.js +20 -4
  113. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
  114. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +5 -3
  115. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.d.ts.map +1 -1
  116. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.js +9 -0
  117. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.d.ts.map +1 -1
  118. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.js +21 -45
  119. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.d.ts.map +1 -1
  120. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.js +7 -1
  121. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts +8 -6
  122. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts.map +1 -1
  123. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.js +8 -6
  124. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts +22 -0
  125. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts.map +1 -0
  126. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.js +73 -0
  127. package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts.map +1 -1
  128. package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.js +51 -1
  129. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts +10 -0
  130. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts.map +1 -0
  131. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.js +42 -0
  132. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts +28 -0
  133. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts.map +1 -0
  134. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.js +227 -0
  135. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts +13 -0
  136. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts.map +1 -0
  137. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.js +108 -0
  138. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts +11 -0
  139. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts.map +1 -0
  140. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.js +20 -0
  141. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts +20 -0
  142. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts.map +1 -0
  143. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.js +38 -0
  144. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
  145. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
  146. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
  147. package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
  148. package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
  149. package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
  150. package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
  151. package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
  152. package/src/core/geom/vec3/v3_negate_array.js +2 -2
  153. package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
  154. package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
  155. package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
  156. package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
  157. package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
  158. package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
  159. package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
  160. package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
  161. package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
  162. package/src/core/graph/csr/CSRGraph.d.ts +168 -0
  163. package/src/core/graph/csr/CSRGraph.d.ts.map +1 -0
  164. package/src/core/graph/csr/CSRGraph.js +319 -0
  165. package/src/core/graph/metis/cluster_mesh_metis.d.ts +12 -0
  166. package/src/core/graph/metis/cluster_mesh_metis.d.ts.map +1 -1
  167. package/src/core/graph/metis/cluster_mesh_metis.js +12 -0
  168. package/src/core/graph/metis/metis.d.ts +19 -0
  169. package/src/core/graph/metis/metis.d.ts.map +1 -1
  170. package/src/core/graph/metis/metis.js +20 -0
  171. package/src/core/graph/metis/metis_cluster_bs.d.ts +11 -0
  172. package/src/core/graph/metis/metis_cluster_bs.d.ts.map +1 -1
  173. package/src/core/graph/metis/metis_cluster_bs.js +11 -0
  174. package/src/core/graph/metis/metis_options.d.ts +17 -2
  175. package/src/core/graph/metis/metis_options.d.ts.map +1 -1
  176. package/src/core/graph/metis/metis_options.js +17 -2
  177. package/src/core/graph/metis/native/MetisGraph.d.ts +144 -0
  178. package/src/core/graph/metis/native/MetisGraph.d.ts.map +1 -0
  179. package/src/core/graph/metis/native/MetisGraph.js +212 -0
  180. package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts +72 -0
  181. package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts.map +1 -0
  182. package/src/core/graph/metis/native/bisection/BisectionScratch.js +101 -0
  183. package/src/core/graph/metis/native/bisection/bisect_graph.d.ts +37 -0
  184. package/src/core/graph/metis/native/bisection/bisect_graph.d.ts.map +1 -0
  185. package/src/core/graph/metis/native/bisection/bisect_graph.js +100 -0
  186. package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts +15 -0
  187. package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts.map +1 -0
  188. package/src/core/graph/metis/native/bisection/compute_2way_params.js +84 -0
  189. package/src/core/graph/metis/native/bisection/fm_2way.d.ts +30 -0
  190. package/src/core/graph/metis/native/bisection/fm_2way.d.ts.map +1 -0
  191. package/src/core/graph/metis/native/bisection/fm_2way.js +290 -0
  192. package/src/core/graph/metis/native/bisection/grow_bisection.d.ts +23 -0
  193. package/src/core/graph/metis/native/bisection/grow_bisection.d.ts.map +1 -0
  194. package/src/core/graph/metis/native/bisection/grow_bisection.js +137 -0
  195. package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts +28 -0
  196. package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts.map +1 -0
  197. package/src/core/graph/metis/native/bisection/split_graph_two_way.js +119 -0
  198. package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts +20 -0
  199. package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts.map +1 -0
  200. package/src/core/graph/metis/native/coarsen/coarsen_graph.js +94 -0
  201. package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts +24 -0
  202. package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts.map +1 -0
  203. package/src/core/graph/metis/native/coarsen/create_coarse_graph.js +158 -0
  204. package/src/core/graph/metis/native/coarsen/match_shem.d.ts +41 -0
  205. package/src/core/graph/metis/native/coarsen/match_shem.d.ts.map +1 -0
  206. package/src/core/graph/metis/native/coarsen/match_shem.js +175 -0
  207. package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts +24 -0
  208. package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts.map +1 -0
  209. package/src/core/graph/metis/native/initial/initial_kway_bfs.js +122 -0
  210. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts +29 -0
  211. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts.map +1 -0
  212. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.js +170 -0
  213. package/src/core/graph/metis/native/metis_partition_kway.d.ts +41 -0
  214. package/src/core/graph/metis/native/metis_partition_kway.d.ts.map +1 -0
  215. package/src/core/graph/metis/native/metis_partition_kway.js +126 -0
  216. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts +62 -0
  217. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts.map +1 -0
  218. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.js +261 -0
  219. package/src/core/graph/metis/native/refine/RefinementScratch.d.ts +45 -0
  220. package/src/core/graph/metis/native/refine/RefinementScratch.d.ts.map +1 -0
  221. package/src/core/graph/metis/native/refine/RefinementScratch.js +53 -0
  222. package/src/core/graph/metis/native/refine/compute_kway_params.d.ts +18 -0
  223. package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -0
  224. package/src/core/graph/metis/native/refine/compute_kway_params.js +138 -0
  225. package/src/core/graph/metis/native/refine/fm_kway.d.ts +63 -0
  226. package/src/core/graph/metis/native/refine/fm_kway.d.ts.map +1 -0
  227. package/src/core/graph/metis/native/refine/fm_kway.js +462 -0
  228. package/src/core/graph/metis/native/refine/project_kway.d.ts +22 -0
  229. package/src/core/graph/metis/native/refine/project_kway.d.ts.map +1 -0
  230. package/src/core/graph/metis/native/refine/project_kway.js +43 -0
  231. package/src/core/graph/metis/native/refine/refine_kway.d.ts +34 -0
  232. package/src/core/graph/metis/native/refine/refine_kway.d.ts.map +1 -0
  233. package/src/core/graph/metis/native/refine/refine_kway.js +43 -0
  234. package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts +2 -2
  235. package/src/core/math/linalg/eigen/matrix_householder_in_place.js +2 -2
  236. package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +6 -4
  237. package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -1
  238. package/src/core/math/linalg/eigen/matrix_qr_in_place.js +69 -23
  239. package/src/engine/EngineHarness.d.ts +3 -1
  240. package/src/engine/EngineHarness.d.ts.map +1 -1
  241. package/src/engine/EngineHarness.js +3 -0
  242. package/src/engine/control/first-person/DESIGN.md +30 -6
  243. package/src/engine/control/first-person/DESIGN_EXTENSIONS.md +563 -0
  244. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +115 -9
  245. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
  246. package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -176
  247. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +601 -8
  248. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
  249. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +349 -8
  250. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +319 -23
  251. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
  252. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -799
  253. package/src/engine/control/first-person/TODO.md +173 -0
  254. package/src/engine/control/first-person/abilities/Ability.d.ts +101 -0
  255. package/src/engine/control/first-person/abilities/Ability.d.ts.map +1 -0
  256. package/src/engine/control/first-person/abilities/Ability.js +119 -0
  257. package/src/engine/control/first-person/abilities/AbilitySet.d.ts +86 -0
  258. package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -0
  259. package/src/engine/control/first-person/abilities/AbilitySet.js +185 -0
  260. package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +62 -0
  261. package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -0
  262. package/src/engine/control/first-person/abilities/LedgeGrab.js +199 -0
  263. package/src/engine/control/first-person/abilities/Mantle.d.ts +45 -0
  264. package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -0
  265. package/src/engine/control/first-person/abilities/Mantle.js +188 -0
  266. package/src/engine/control/first-person/abilities/Slide.d.ts +33 -0
  267. package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -0
  268. package/src/engine/control/first-person/abilities/Slide.js +166 -0
  269. package/src/engine/control/first-person/abilities/WallJump.d.ts +45 -0
  270. package/src/engine/control/first-person/abilities/WallJump.d.ts.map +1 -0
  271. package/src/engine/control/first-person/abilities/WallJump.js +131 -0
  272. package/src/engine/control/first-person/abilities/WallRun.d.ts +44 -0
  273. package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -0
  274. package/src/engine/control/first-person/abilities/WallRun.js +180 -0
  275. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +49 -0
  276. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +1 -0
  277. package/src/engine/control/first-person/composer/EyeOffsetStack.js +60 -0
  278. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts +100 -0
  279. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts.map +1 -0
  280. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.js +133 -0
  281. package/src/engine/control/first-person/mastery/DecisionPoint.d.ts +10 -0
  282. package/src/engine/control/first-person/mastery/DecisionPoint.d.ts.map +1 -0
  283. package/src/engine/control/first-person/mastery/DecisionPoint.js +30 -0
  284. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts +61 -0
  285. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts.map +1 -0
  286. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.js +109 -0
  287. package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts +40 -0
  288. package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts.map +1 -0
  289. package/src/engine/control/first-person/mastery/MasteryEvaluator.js +45 -0
  290. package/src/engine/control/first-person/mastery/MasteryScore.d.ts +68 -0
  291. package/src/engine/control/first-person/mastery/MasteryScore.d.ts.map +1 -0
  292. package/src/engine/control/first-person/mastery/MasteryScore.js +100 -0
  293. package/src/engine/control/first-person/mastery/MasterySet.d.ts +60 -0
  294. package/src/engine/control/first-person/mastery/MasterySet.d.ts.map +1 -0
  295. package/src/engine/control/first-person/mastery/MasterySet.js +86 -0
  296. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts +58 -0
  297. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts.map +1 -0
  298. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.js +83 -0
  299. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts +69 -0
  300. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts.map +1 -0
  301. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.js +109 -0
  302. package/src/engine/control/first-person/math/Spring.d.ts +56 -0
  303. package/src/engine/control/first-person/math/Spring.d.ts.map +1 -0
  304. package/src/engine/control/first-person/math/Spring.js +71 -0
  305. package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts +26 -0
  306. package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts.map +1 -0
  307. package/src/engine/control/first-person/math/computeLRCBreathRate.js +41 -0
  308. package/src/engine/control/first-person/math/computeMassRatios.d.ts +35 -0
  309. package/src/engine/control/first-person/math/computeMassRatios.d.ts.map +1 -0
  310. package/src/engine/control/first-person/math/computeMassRatios.js +44 -0
  311. package/src/engine/control/first-person/pose/FirstPersonPose.d.ts +31 -1
  312. package/src/engine/control/first-person/pose/FirstPersonPose.d.ts.map +1 -1
  313. package/src/engine/control/first-person/pose/FirstPersonPose.js +49 -3
  314. package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts +7 -0
  315. package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts.map +1 -0
  316. package/src/engine/control/first-person/pose/FirstPersonPosture.js +27 -0
  317. package/src/engine/control/first-person/prototype_first_person_controller.js +637 -120
  318. package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts +58 -0
  319. package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts.map +1 -0
  320. package/src/engine/control/first-person/sensors/FirstPersonSensors.js +77 -0
  321. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +80 -0
  322. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -0
  323. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +196 -0
  324. package/src/engine/control/first-person/test/buildTestPlayer.d.ts +20 -0
  325. package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -0
  326. package/src/engine/control/first-person/test/buildTestPlayer.js +36 -0
  327. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -2
  328. package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
  329. package/src/engine/graphics/ecs/light/Light.js +27 -0
  330. package/src/engine/graphics/ecs/light/LightSystem.js +1 -1
  331. package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
  332. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
  333. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +0 -2
  334. package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
  335. package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
  336. package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
  337. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
  338. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -2
  339. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
  340. package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
  341. package/src/engine/navigation/grid/find_path_on_grid_astar.js +11 -2
  342. package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -1
  343. package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +11 -1
  344. package/src/engine/physics/BULLET_REVIEW.md +945 -0
  345. package/src/engine/physics/CANNON_REVIEW.md +1300 -0
  346. package/src/engine/physics/JOLT_REVIEW.md +913 -0
  347. package/src/engine/physics/PLAN.md +461 -0
  348. package/src/engine/physics/RAPIER_REVIEW.md +934 -0
  349. package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
  350. package/src/engine/physics/body/BodyStorage.d.ts +187 -0
  351. package/src/engine/physics/body/BodyStorage.d.ts.map +1 -0
  352. package/src/engine/physics/body/BodyStorage.js +427 -0
  353. package/src/engine/physics/broadphase/PairList.d.ts +62 -0
  354. package/src/engine/physics/broadphase/PairList.d.ts.map +1 -0
  355. package/src/engine/physics/broadphase/PairList.js +97 -0
  356. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +16 -0
  357. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -0
  358. package/src/engine/physics/broadphase/compute_fat_world_aabb.js +61 -0
  359. package/src/engine/physics/broadphase/generate_pairs.d.ts +38 -0
  360. package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -0
  361. package/src/engine/physics/broadphase/generate_pairs.js +101 -0
  362. package/src/engine/physics/contact/ManifoldStore.d.ts +299 -0
  363. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -0
  364. package/src/engine/physics/contact/ManifoldStore.js +608 -0
  365. package/src/engine/physics/ecs/BodyKind.d.ts +23 -0
  366. package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -0
  367. package/src/engine/physics/ecs/BodyKind.js +24 -0
  368. package/src/engine/physics/ecs/Collider.d.ts +98 -0
  369. package/src/engine/physics/ecs/Collider.d.ts.map +1 -0
  370. package/src/engine/physics/ecs/Collider.js +136 -0
  371. package/src/engine/physics/ecs/ColliderFlags.d.ts +14 -0
  372. package/src/engine/physics/ecs/ColliderFlags.d.ts.map +1 -0
  373. package/src/engine/physics/ecs/ColliderFlags.js +15 -0
  374. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +58 -0
  375. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -0
  376. package/src/engine/physics/ecs/ColliderObserverSystem.js +103 -0
  377. package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts +25 -0
  378. package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts.map +1 -0
  379. package/src/engine/physics/ecs/ColliderSerializationAdapter.js +37 -0
  380. package/src/engine/physics/ecs/PhysicsEvents.d.ts +15 -0
  381. package/src/engine/physics/ecs/PhysicsEvents.d.ts.map +1 -0
  382. package/src/engine/physics/ecs/PhysicsEvents.js +16 -0
  383. package/src/engine/physics/ecs/PhysicsSystem.d.ts +628 -0
  384. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -0
  385. package/src/engine/physics/ecs/PhysicsSystem.js +1301 -0
  386. package/src/engine/physics/ecs/RigidBody.d.ts +197 -0
  387. package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -0
  388. package/src/engine/physics/ecs/RigidBody.js +240 -0
  389. package/src/engine/physics/ecs/RigidBodyFlags.d.ts +21 -0
  390. package/src/engine/physics/ecs/RigidBodyFlags.d.ts.map +1 -0
  391. package/src/engine/physics/ecs/RigidBodyFlags.js +22 -0
  392. package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +28 -0
  393. package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -0
  394. package/src/engine/physics/ecs/RigidBodySerializationAdapter.js +81 -0
  395. package/src/engine/physics/ecs/SleepState.d.ts +11 -0
  396. package/src/engine/physics/ecs/SleepState.d.ts.map +1 -0
  397. package/src/engine/physics/ecs/SleepState.js +12 -0
  398. package/src/engine/physics/events/ContactEventBuffer.d.ts +46 -0
  399. package/src/engine/physics/events/ContactEventBuffer.d.ts.map +1 -0
  400. package/src/engine/physics/events/ContactEventBuffer.js +83 -0
  401. package/src/engine/physics/events/diff_manifolds.d.ts +25 -0
  402. package/src/engine/physics/events/diff_manifolds.d.ts.map +1 -0
  403. package/src/engine/physics/events/diff_manifolds.js +50 -0
  404. package/src/engine/physics/fluid/FluidField.d.ts +294 -16
  405. package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
  406. package/src/engine/physics/fluid/FluidField.js +510 -66
  407. package/src/engine/physics/fluid/FluidSimulator.d.ts +188 -5
  408. package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
  409. package/src/engine/physics/fluid/FluidSimulator.js +456 -95
  410. package/src/engine/physics/fluid/SliceVisualiser.d.ts +29 -6
  411. package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
  412. package/src/engine/physics/fluid/SliceVisualiser.js +190 -165
  413. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts +154 -0
  414. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -0
  415. package/src/engine/physics/fluid/ecs/FluidComponent.js +238 -0
  416. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts +45 -0
  417. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts.map +1 -0
  418. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.js +89 -0
  419. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +107 -0
  420. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -0
  421. package/src/engine/physics/fluid/ecs/FluidSystem.js +278 -0
  422. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +62 -1
  423. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts.map +1 -1
  424. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +81 -6
  425. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +17 -4
  426. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  427. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +105 -12
  428. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts +43 -0
  429. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -0
  430. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +210 -0
  431. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts +62 -1
  432. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
  433. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +302 -8
  434. package/src/engine/physics/fluid/prototype.js +102 -91
  435. package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts +33 -0
  436. package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts.map +1 -0
  437. package/src/engine/physics/fluid/solver/optimal_sor_omega.js +41 -0
  438. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts +20 -5
  439. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts.map +1 -1
  440. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.js +60 -38
  441. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts +25 -4
  442. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts.map +1 -1
  443. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.js +93 -73
  444. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts +23 -0
  445. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts.map +1 -0
  446. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.js +60 -0
  447. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts +23 -0
  448. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts.map +1 -0
  449. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.js +68 -0
  450. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +30 -0
  451. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -0
  452. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +66 -0
  453. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts +26 -0
  454. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts.map +1 -0
  455. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.js +113 -0
  456. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts +30 -0
  457. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts.map +1 -0
  458. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.js +107 -0
  459. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +49 -0
  460. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -0
  461. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +126 -0
  462. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +93 -0
  463. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -0
  464. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +424 -0
  465. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +48 -0
  466. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -0
  467. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +92 -0
  468. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
  469. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
  470. package/src/engine/physics/gjk/expanding_polytope_algorithm.js +76 -32
  471. package/src/engine/physics/gjk/gjk.d.ts +28 -2
  472. package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
  473. package/src/engine/physics/gjk/gjk.js +421 -378
  474. package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
  475. package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
  476. package/src/engine/physics/gjk/minkowski_support.js +75 -0
  477. package/src/engine/physics/gjk/mpr.d.ts +56 -0
  478. package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
  479. package/src/engine/physics/gjk/mpr.js +344 -0
  480. package/src/engine/physics/inertia/world_inverse_inertia.d.ts +44 -0
  481. package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -0
  482. package/src/engine/physics/inertia/world_inverse_inertia.js +77 -0
  483. package/src/engine/physics/integration/integrate_position.d.ts +34 -0
  484. package/src/engine/physics/integration/integrate_position.d.ts.map +1 -0
  485. package/src/engine/physics/integration/integrate_position.js +79 -0
  486. package/src/engine/physics/integration/integrate_velocity.d.ts +55 -0
  487. package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -0
  488. package/src/engine/physics/integration/integrate_velocity.js +160 -0
  489. package/src/engine/physics/integration/quat_integrate.d.ts +27 -0
  490. package/src/engine/physics/integration/quat_integrate.d.ts.map +1 -0
  491. package/src/engine/physics/integration/quat_integrate.js +62 -0
  492. package/src/engine/physics/island/IslandBuilder.d.ts +167 -0
  493. package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -0
  494. package/src/engine/physics/island/IslandBuilder.js +411 -0
  495. package/src/engine/physics/island/union_find.d.ts +51 -0
  496. package/src/engine/physics/island/union_find.d.ts.map +1 -0
  497. package/src/engine/physics/island/union_find.js +76 -0
  498. package/src/engine/physics/narrowphase/PosedShape.d.ts +51 -0
  499. package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -0
  500. package/src/engine/physics/narrowphase/PosedShape.js +108 -0
  501. package/src/engine/physics/narrowphase/box_box_manifold.d.ts +32 -0
  502. package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -0
  503. package/src/engine/physics/narrowphase/box_box_manifold.js +639 -0
  504. package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
  505. package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
  506. package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
  507. package/src/engine/physics/narrowphase/capsule_contacts.d.ts +122 -0
  508. package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -0
  509. package/src/engine/physics/narrowphase/capsule_contacts.js +462 -0
  510. package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
  511. package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
  512. package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
  513. package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
  514. package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
  515. package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
  516. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
  517. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
  518. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
  519. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
  520. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
  521. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
  522. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
  523. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
  524. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
  525. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
  526. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
  527. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
  528. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
  529. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
  530. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
  531. package/src/engine/physics/narrowphase/narrowphase_step.d.ts +17 -0
  532. package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -0
  533. package/src/engine/physics/narrowphase/narrowphase_step.js +1422 -0
  534. package/src/engine/physics/narrowphase/sphere_box_contact.d.ts +38 -0
  535. package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -0
  536. package/src/engine/physics/narrowphase/sphere_box_contact.js +123 -0
  537. package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts +26 -0
  538. package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts.map +1 -0
  539. package/src/engine/physics/narrowphase/sphere_sphere_contact.js +51 -0
  540. package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
  541. package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
  542. package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
  543. package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts +83 -0
  544. package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts.map +1 -0
  545. package/src/engine/physics/queries/PhysicsSurfacePoint.js +100 -0
  546. package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
  547. package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
  548. package/src/engine/physics/queries/overlap_shape.js +183 -0
  549. package/src/engine/physics/queries/raycast.d.ts +20 -0
  550. package/src/engine/physics/queries/raycast.d.ts.map +1 -0
  551. package/src/engine/physics/queries/raycast.js +249 -0
  552. package/src/engine/physics/queries/shape_cast.d.ts +56 -0
  553. package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
  554. package/src/engine/physics/queries/shape_cast.js +387 -0
  555. package/src/engine/physics/solver/friction_cone.d.ts +16 -0
  556. package/src/engine/physics/solver/friction_cone.d.ts.map +1 -0
  557. package/src/engine/physics/solver/friction_cone.js +37 -0
  558. package/src/engine/physics/solver/solve_contacts.d.ts +122 -0
  559. package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -0
  560. package/src/engine/physics/solver/solve_contacts.js +1016 -0
  561. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts +0 -34
  562. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts.map +0 -1
  563. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.js +0 -66
  564. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts +0 -2
  565. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts.map +0 -1
  566. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.js +0 -54
  567. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts +0 -2
  568. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts.map +0 -1
  569. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.js +0 -26
  570. package/src/engine/ecs/components/Motion.d.ts +0 -21
  571. package/src/engine/ecs/components/Motion.d.ts.map +0 -1
  572. package/src/engine/ecs/components/Motion.js +0 -27
  573. package/src/engine/ecs/components/MotionSerializationAdapter.d.ts +0 -20
  574. package/src/engine/ecs/components/MotionSerializationAdapter.d.ts.map +0 -1
  575. package/src/engine/ecs/components/MotionSerializationAdapter.js +0 -26
  576. package/src/engine/ecs/systems/MotionSystem.d.ts +0 -9
  577. package/src/engine/ecs/systems/MotionSystem.d.ts.map +0 -1
  578. package/src/engine/ecs/systems/MotionSystem.js +0 -29
  579. package/src/engine/physics/fluid/Fluid.d.ts +0 -26
  580. package/src/engine/physics/fluid/Fluid.d.ts.map +0 -1
  581. package/src/engine/physics/fluid/Fluid.js +0 -221
  582. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts +0 -7
  583. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts.map +0 -1
  584. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.js +0 -8
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Closed-form contact generation for a unit sphere vs. an oriented box.
3
+ *
4
+ * Algorithm: transform the sphere centre into the box's body frame, clamp it
5
+ * to the box's half-extents to get the closest surface point in body space,
6
+ * measure the distance, and (when overlapping) rotate the resulting normal
7
+ * and surface point back into world.
8
+ *
9
+ * Singular cases:
10
+ * - If the sphere centre is inside the box (distance == 0 in body frame),
11
+ * the closest-face vector is undefined; we pick the smallest-overlap face
12
+ * direction as a deterministic tie-break.
13
+ *
14
+ * Output convention (mirrors {@link sphere_sphere_contact}): the normal in
15
+ * `out[0..2]` points from the box surface toward the sphere centre; `out[3]`
16
+ * is the (positive) penetration depth; `out[4..6]` is the world-space contact
17
+ * point on the sphere's surface; `out[7..9]` is the world-space contact point
18
+ * on the box's surface.
19
+ *
20
+ * @param {number[]|Float64Array} out length >= 10
21
+ * @param {number} sx sphere centre x
22
+ * @param {number} sy
23
+ * @param {number} sz
24
+ * @param {number} radius
25
+ * @param {number} bx box centre x
26
+ * @param {number} by
27
+ * @param {number} bz
28
+ * @param {number} bqx box rotation quaternion x
29
+ * @param {number} bqy
30
+ * @param {number} bqz
31
+ * @param {number} bqw
32
+ * @param {number} hx box half-extent x (body frame)
33
+ * @param {number} hy
34
+ * @param {number} hz
35
+ * @returns {boolean} true if overlap
36
+ */
37
+ export function sphere_box_contact(out: number[] | Float64Array, sx: number, sy: number, sz: number, radius: number, bx: number, by: number, bz: number, bqx: number, bqy: number, bqz: number, bqw: number, hx: number, hy: number, hz: number): boolean;
38
+ //# sourceMappingURL=sphere_box_contact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere_box_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/sphere_box_contact.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wCAjBW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,MACN,MAAM,MACN,MAAM,UACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CA8EnB"}
@@ -0,0 +1,123 @@
1
+ import { v3_quat3_apply } from "../../../core/geom/vec3/v3_quat3_apply.js";
2
+ import { v3_quat3_apply_inverse } from "../../../core/geom/vec3/v3_quat3_apply_inverse.js";
3
+
4
+ /**
5
+ * Scratch for the world→box-local rotation of the sphere centre at the
6
+ * top of {@link sphere_box_contact}. 3 floats; allocation-free.
7
+ * @type {Float64Array}
8
+ */
9
+ const scratch_local = new Float64Array(3);
10
+
11
+ /**
12
+ * Closed-form contact generation for a unit sphere vs. an oriented box.
13
+ *
14
+ * Algorithm: transform the sphere centre into the box's body frame, clamp it
15
+ * to the box's half-extents to get the closest surface point in body space,
16
+ * measure the distance, and (when overlapping) rotate the resulting normal
17
+ * and surface point back into world.
18
+ *
19
+ * Singular cases:
20
+ * - If the sphere centre is inside the box (distance == 0 in body frame),
21
+ * the closest-face vector is undefined; we pick the smallest-overlap face
22
+ * direction as a deterministic tie-break.
23
+ *
24
+ * Output convention (mirrors {@link sphere_sphere_contact}): the normal in
25
+ * `out[0..2]` points from the box surface toward the sphere centre; `out[3]`
26
+ * is the (positive) penetration depth; `out[4..6]` is the world-space contact
27
+ * point on the sphere's surface; `out[7..9]` is the world-space contact point
28
+ * on the box's surface.
29
+ *
30
+ * @param {number[]|Float64Array} out length >= 10
31
+ * @param {number} sx sphere centre x
32
+ * @param {number} sy
33
+ * @param {number} sz
34
+ * @param {number} radius
35
+ * @param {number} bx box centre x
36
+ * @param {number} by
37
+ * @param {number} bz
38
+ * @param {number} bqx box rotation quaternion x
39
+ * @param {number} bqy
40
+ * @param {number} bqz
41
+ * @param {number} bqw
42
+ * @param {number} hx box half-extent x (body frame)
43
+ * @param {number} hy
44
+ * @param {number} hz
45
+ * @returns {boolean} true if overlap
46
+ */
47
+ export function sphere_box_contact(
48
+ out,
49
+ sx, sy, sz, radius,
50
+ bx, by, bz,
51
+ bqx, bqy, bqz, bqw,
52
+ hx, hy, hz
53
+ ) {
54
+ // Step 1: bring the sphere centre into box-local space via the conjugate
55
+ // quaternion. v_local = q* · (s - b) · q
56
+ v3_quat3_apply_inverse(scratch_local, 0, sx - bx, sy - by, sz - bz, bqx, bqy, bqz, bqw);
57
+ const lx = scratch_local[0];
58
+ const ly = scratch_local[1];
59
+ const lz = scratch_local[2];
60
+
61
+ // Step 2: closest point on the box to the sphere centre, in body frame.
62
+ const clx = lx < -hx ? -hx : (lx > hx ? hx : lx);
63
+ const cly = ly < -hy ? -hy : (ly > hy ? hy : ly);
64
+ const clz = lz < -hz ? -hz : (lz > hz ? hz : lz);
65
+
66
+ const inside = clx === lx && cly === ly && clz === lz;
67
+
68
+ let nlx, nly, nlz, dist;
69
+ if (!inside) {
70
+ // Centre is outside the box: normal is from clamped point toward centre.
71
+ const ex = lx - clx, ey = ly - cly, ez = lz - clz;
72
+ const dist_sqr = ex * ex + ey * ey + ez * ez;
73
+ if (dist_sqr >= radius * radius) {
74
+ return false;
75
+ }
76
+ dist = Math.sqrt(dist_sqr);
77
+ if (dist > 0) {
78
+ const inv = 1 / dist;
79
+ nlx = ex * inv; nly = ey * inv; nlz = ez * inv;
80
+ } else {
81
+ // Centre lies exactly on a face — pick +X as a tie-break.
82
+ nlx = 1; nly = 0; nlz = 0;
83
+ }
84
+ } else {
85
+ // Centre is inside the box. Closest face is the one we're nearest to.
86
+ // Compute the per-axis "distance to face" (positive); pick min.
87
+ const dx_face = hx - Math.abs(lx);
88
+ const dy_face = hy - Math.abs(ly);
89
+ const dz_face = hz - Math.abs(lz);
90
+
91
+ // Pick smallest depth-to-face; ties broken X > Y > Z (deterministic).
92
+ if (dx_face <= dy_face && dx_face <= dz_face) {
93
+ nlx = lx >= 0 ? 1 : -1; nly = 0; nlz = 0;
94
+ dist = -dx_face;
95
+ } else if (dy_face <= dz_face) {
96
+ nlx = 0; nly = ly >= 0 ? 1 : -1; nlz = 0;
97
+ dist = -dy_face;
98
+ } else {
99
+ nlx = 0; nly = 0; nlz = lz >= 0 ? 1 : -1;
100
+ dist = -dz_face;
101
+ }
102
+ }
103
+
104
+ // Step 3: rotate normal and surface point back to world. v_world = q · v · q*
105
+
106
+ // World normal (box → sphere).
107
+ v3_quat3_apply(out, 0, nlx, nly, nlz, bqx, bqy, bqz, bqw);
108
+ const nx = out[0], ny = out[1], nz = out[2];
109
+ out[3] = radius - dist;
110
+
111
+ // World contact on sphere = sphere_center - normal * radius.
112
+ out[4] = sx - nx * radius;
113
+ out[5] = sy - ny * radius;
114
+ out[6] = sz - nz * radius;
115
+
116
+ // World contact on box: rotate the local-space clamped point to world, plus box centre.
117
+ v3_quat3_apply(out, 7, clx, cly, clz, bqx, bqy, bqz, bqw);
118
+ out[7] += bx;
119
+ out[8] += by;
120
+ out[9] += bz;
121
+
122
+ return true;
123
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Closed-form contact generation for two unit spheres positioned in world
3
+ * space. Returns whether the spheres overlap. On overlap, `out` is populated
4
+ * with `[nx, ny, nz, depth]` where the normal points from B toward A and
5
+ * `depth` is the positive penetration distance.
6
+ *
7
+ * Both spheres have radius 1 (the {@link UnitSphereShape3D} convention); any
8
+ * scaling on the body's transform is irrelevant under our "no scale on
9
+ * physics transforms" assumption.
10
+ *
11
+ * Centres-coincident is a singular case for the general normal but is
12
+ * resolved here by picking +X as a deterministic tie-break direction.
13
+ *
14
+ * @param {number[]|Float64Array} out length >= 4
15
+ * @param {number} ax
16
+ * @param {number} ay
17
+ * @param {number} az
18
+ * @param {number} bx
19
+ * @param {number} by
20
+ * @param {number} bz
21
+ * @param {number} radius_a
22
+ * @param {number} radius_b
23
+ * @returns {boolean} true if spheres overlap
24
+ */
25
+ export function sphere_sphere_contact(out: number[] | Float64Array, ax: number, ay: number, az: number, bx: number, by: number, bz: number, radius_a: number, radius_b: number): boolean;
26
+ //# sourceMappingURL=sphere_sphere_contact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere_sphere_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/sphere_sphere_contact.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,2CAXW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,YACN,MAAM,YACN,MAAM,GACJ,OAAO,CA4BnB"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Closed-form contact generation for two unit spheres positioned in world
3
+ * space. Returns whether the spheres overlap. On overlap, `out` is populated
4
+ * with `[nx, ny, nz, depth]` where the normal points from B toward A and
5
+ * `depth` is the positive penetration distance.
6
+ *
7
+ * Both spheres have radius 1 (the {@link UnitSphereShape3D} convention); any
8
+ * scaling on the body's transform is irrelevant under our "no scale on
9
+ * physics transforms" assumption.
10
+ *
11
+ * Centres-coincident is a singular case for the general normal but is
12
+ * resolved here by picking +X as a deterministic tie-break direction.
13
+ *
14
+ * @param {number[]|Float64Array} out length >= 4
15
+ * @param {number} ax
16
+ * @param {number} ay
17
+ * @param {number} az
18
+ * @param {number} bx
19
+ * @param {number} by
20
+ * @param {number} bz
21
+ * @param {number} radius_a
22
+ * @param {number} radius_b
23
+ * @returns {boolean} true if spheres overlap
24
+ */
25
+ export function sphere_sphere_contact(out, ax, ay, az, bx, by, bz, radius_a, radius_b) {
26
+ const dx = ax - bx;
27
+ const dy = ay - by;
28
+ const dz = az - bz;
29
+ const dist_sqr = dx * dx + dy * dy + dz * dz;
30
+
31
+ const sum = radius_a + radius_b;
32
+ if (dist_sqr >= sum * sum) {
33
+ return false;
34
+ }
35
+
36
+ const dist = Math.sqrt(dist_sqr);
37
+ if (dist > 0) {
38
+ const inv = 1 / dist;
39
+ out[0] = dx * inv;
40
+ out[1] = dy * inv;
41
+ out[2] = dz * inv;
42
+ } else {
43
+ // Centres coincide. Pick +X deterministically (no RNG); penetration is
44
+ // the full sum of radii.
45
+ out[0] = 1;
46
+ out[1] = 0;
47
+ out[2] = 0;
48
+ }
49
+ out[3] = sum - dist;
50
+ return true;
51
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Closed-form contact generation for a sphere vs. a triangle.
3
+ *
4
+ * Algorithm: find the closest point on the triangle to the sphere centre
5
+ * via Ericson barycentric voronoi-region projection, then compare the
6
+ * distance to the sphere radius. The result is closed-form, exact for
7
+ * the geometric primitives involved, and avoids the precision wall that
8
+ * GJK+EPA hits on {@link Triangle3D} — whose support function is
9
+ * degenerate along the face normal (all 3 vertices project to the same
10
+ * value) and produces noisy depths at small penetrations.
11
+ *
12
+ * Sphere-vs-triangle is the building block for sphere-vs-concave
13
+ * (mesh, heightmap) narrowphase: the concave dispatch in
14
+ * {@link narrowphase_step} decomposes the concave shape into world-space
15
+ * triangles and runs this function per triangle.
16
+ *
17
+ * Output convention (mirrors {@link sphere_box_contact} and
18
+ * {@link sphere_sphere_contact}): the normal in `out[0..2]` points
19
+ * from the triangle's surface toward the sphere centre — i.e. the
20
+ * direction the sphere should be pushed to separate; `out[3]` is the
21
+ * positive penetration depth; `out[4..6]` is the world contact on
22
+ * the sphere's surface; `out[7..9]` is the world contact on the
23
+ * triangle's surface (the closest point).
24
+ *
25
+ * Singular case: when the sphere centre lies exactly on the triangle's
26
+ * plane (distance == 0), the normal direction is geometrically undefined.
27
+ * We fall back to the triangle's face normal (CCW winding), which is the
28
+ * direction the surrounding solid is "outward" from for closed meshes
29
+ * and heightmaps.
30
+ *
31
+ * @param {number[]|Float64Array} out length >= 10
32
+ * @param {number} sx sphere centre x (world)
33
+ * @param {number} sy
34
+ * @param {number} sz
35
+ * @param {number} radius
36
+ * @param {number} ax triangle vertex A x (world)
37
+ * @param {number} ay
38
+ * @param {number} az
39
+ * @param {number} bx triangle vertex B x (world)
40
+ * @param {number} by
41
+ * @param {number} bz
42
+ * @param {number} cx triangle vertex C x (world)
43
+ * @param {number} cy
44
+ * @param {number} cz
45
+ * @returns {boolean} true if sphere overlaps the triangle
46
+ */
47
+ export function sphere_triangle_contact(out: number[] | Float64Array, sx: number, sy: number, sz: number, radius: number, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): boolean;
48
+ //# sourceMappingURL=sphere_triangle_contact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere_triangle_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/sphere_triangle_contact.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,6CAhBW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,MACN,MAAM,MACN,MAAM,UACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAwFnB"}
@@ -0,0 +1,143 @@
1
+ import { computeTriangleClosestPointToPointBarycentric } from "../../../core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js";
2
+
3
+ /**
4
+ * Closest-point on triangle, written into the first two floats of `out`
5
+ * as `(alpha_A, alpha_B)` — `alpha_C = 1 - alpha_A - alpha_B`. Reused
6
+ * across the {@link sphere_triangle_contact} body to avoid allocation.
7
+ * @type {Float64Array}
8
+ */
9
+ const scratch_bary = new Float64Array(2);
10
+
11
+ /**
12
+ * Closed-form contact generation for a sphere vs. a triangle.
13
+ *
14
+ * Algorithm: find the closest point on the triangle to the sphere centre
15
+ * via Ericson barycentric voronoi-region projection, then compare the
16
+ * distance to the sphere radius. The result is closed-form, exact for
17
+ * the geometric primitives involved, and avoids the precision wall that
18
+ * GJK+EPA hits on {@link Triangle3D} — whose support function is
19
+ * degenerate along the face normal (all 3 vertices project to the same
20
+ * value) and produces noisy depths at small penetrations.
21
+ *
22
+ * Sphere-vs-triangle is the building block for sphere-vs-concave
23
+ * (mesh, heightmap) narrowphase: the concave dispatch in
24
+ * {@link narrowphase_step} decomposes the concave shape into world-space
25
+ * triangles and runs this function per triangle.
26
+ *
27
+ * Output convention (mirrors {@link sphere_box_contact} and
28
+ * {@link sphere_sphere_contact}): the normal in `out[0..2]` points
29
+ * from the triangle's surface toward the sphere centre — i.e. the
30
+ * direction the sphere should be pushed to separate; `out[3]` is the
31
+ * positive penetration depth; `out[4..6]` is the world contact on
32
+ * the sphere's surface; `out[7..9]` is the world contact on the
33
+ * triangle's surface (the closest point).
34
+ *
35
+ * Singular case: when the sphere centre lies exactly on the triangle's
36
+ * plane (distance == 0), the normal direction is geometrically undefined.
37
+ * We fall back to the triangle's face normal (CCW winding), which is the
38
+ * direction the surrounding solid is "outward" from for closed meshes
39
+ * and heightmaps.
40
+ *
41
+ * @param {number[]|Float64Array} out length >= 10
42
+ * @param {number} sx sphere centre x (world)
43
+ * @param {number} sy
44
+ * @param {number} sz
45
+ * @param {number} radius
46
+ * @param {number} ax triangle vertex A x (world)
47
+ * @param {number} ay
48
+ * @param {number} az
49
+ * @param {number} bx triangle vertex B x (world)
50
+ * @param {number} by
51
+ * @param {number} bz
52
+ * @param {number} cx triangle vertex C x (world)
53
+ * @param {number} cy
54
+ * @param {number} cz
55
+ * @returns {boolean} true if sphere overlaps the triangle
56
+ */
57
+ export function sphere_triangle_contact(
58
+ out,
59
+ sx, sy, sz, radius,
60
+ ax, ay, az,
61
+ bx, by, bz,
62
+ cx, cy, cz
63
+ ) {
64
+ // Degenerate-triangle guard. For zero-area triangles (colinear or
65
+ // duplicate vertices) the closest-point algorithm still returns
66
+ // a point on the degenerate "line" but the surrounding geometry
67
+ // has no meaningful face — emitting a contact would mislead the
68
+ // solver. Catch this upfront via the face-normal cross product;
69
+ // the same magnitude is reused for the dist=0 fallback below.
70
+ //
71
+ // Cost: 9 flops + 1 sqrt. Negligible vs. the rest of the function
72
+ // and saves the caller from having to pre-filter its input.
73
+ const e1x = bx - ax, e1y = by - ay, e1z = bz - az;
74
+ const e2x = cx - ax, e2y = cy - ay, e2z = cz - az;
75
+ const fnx = e1y * e2z - e1z * e2y;
76
+ const fny = e1z * e2x - e1x * e2z;
77
+ const fnz = e1x * e2y - e1y * e2x;
78
+ const fn_mag_sqr = fnx * fnx + fny * fny + fnz * fnz;
79
+ if (fn_mag_sqr === 0) return false;
80
+
81
+ // Closest-point on triangle to sphere centre — barycentric output.
82
+ computeTriangleClosestPointToPointBarycentric(
83
+ scratch_bary, 0,
84
+ sx, sy, sz,
85
+ ax, ay, az,
86
+ bx, by, bz,
87
+ cx, cy, cz
88
+ );
89
+ const alpha_a = scratch_bary[0];
90
+ const alpha_b = scratch_bary[1];
91
+ const alpha_c = 1 - alpha_a - alpha_b;
92
+
93
+ // Reconstruct the closest world-space point.
94
+ const px = alpha_a * ax + alpha_b * bx + alpha_c * cx;
95
+ const py = alpha_a * ay + alpha_b * by + alpha_c * cy;
96
+ const pz = alpha_a * az + alpha_b * bz + alpha_c * cz;
97
+
98
+ // Vector from closest point to sphere centre.
99
+ const dx = sx - px;
100
+ const dy = sy - py;
101
+ const dz = sz - pz;
102
+ const dist_sqr = dx * dx + dy * dy + dz * dz;
103
+
104
+ if (dist_sqr >= radius * radius) {
105
+ return false;
106
+ }
107
+
108
+ const dist = Math.sqrt(dist_sqr);
109
+ let nx, ny, nz;
110
+ if (dist > 0) {
111
+ const inv = 1 / dist;
112
+ nx = dx * inv;
113
+ ny = dy * inv;
114
+ nz = dz * inv;
115
+ } else {
116
+ // Sphere centre lies on the triangle's surface — direction is
117
+ // undefined. Fall back to the triangle's face normal (CCW
118
+ // winding: (B - A) × (C - A)), which is the outward direction
119
+ // for closed meshes and heightmaps. The cross product was
120
+ // already computed for the degeneracy guard at the top of
121
+ // the function; reuse fn_mag_sqr.
122
+ const fn_mag = Math.sqrt(fn_mag_sqr);
123
+ const inv_fn = 1 / fn_mag;
124
+ nx = fnx * inv_fn;
125
+ ny = fny * inv_fn;
126
+ nz = fnz * inv_fn;
127
+ }
128
+
129
+ out[0] = nx;
130
+ out[1] = ny;
131
+ out[2] = nz;
132
+ out[3] = radius - dist;
133
+ // Sphere surface point: centre minus normal*radius (the point on
134
+ // the sphere nearest the triangle).
135
+ out[4] = sx - nx * radius;
136
+ out[5] = sy - ny * radius;
137
+ out[6] = sz - nz * radius;
138
+ // Triangle surface point: the closest point we already computed.
139
+ out[7] = px;
140
+ out[8] = py;
141
+ out[9] = pz;
142
+ return true;
143
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Result of a {@link PhysicsSystem} query that resolves to a single surface
3
+ * contact — raycast hit, sphere overlap nearest-point, shape-cast first
4
+ * blocker, etc.
5
+ *
6
+ * The class is an *output parameter*: callers pre-allocate one (or pull one
7
+ * from a frame-pool) and pass it into the query. The query writes the fields
8
+ * on hit and returns `true`; on miss it returns `false` and leaves the
9
+ * fields untouched.
10
+ *
11
+ * Pre-allocation matters because a query that gets called every frame (a
12
+ * ground sensor, a hover beam) would otherwise drop a small object on the
13
+ * GC per call. Reusing the same `PhysicsSurfacePoint` keeps that allocation
14
+ * out of the hot path.
15
+ *
16
+ * Field layout chosen to match what gameplay code typically needs:
17
+ * - `position` — world-space point on the surface
18
+ * - `normal` — surface normal at that point (broadphase queries return
19
+ * the AABB face normal as an approximation; narrowphase-refined queries
20
+ * would return the true shape normal at the same call site)
21
+ * - `t` — distance along the input ray, sphere-cast, etc. Useful when the
22
+ * caller wants to interpolate or step along the query primitive
23
+ * (`origin + t·direction` reconstructs the hit point exactly without
24
+ * reading `position`, which the deferred-execution physics events bus
25
+ * would otherwise need to copy).
26
+ * - `entity` — entity id that owns the hit body
27
+ * - `body_id` — packed body id (index << 8 | generation); stale after the
28
+ * body is unlinked, so prefer `entity` for any cross-frame retention.
29
+ *
30
+ * @author Alex Goldring
31
+ * @copyright Company Named Limited (c) 2026
32
+ */
33
+ export class PhysicsSurfacePoint {
34
+ /**
35
+ * World-space point on the hit surface.
36
+ * @readonly
37
+ * @type {Vector3}
38
+ */
39
+ readonly position: Vector3;
40
+ /**
41
+ * Surface normal at {@link position}, unit length. For broadphase-only
42
+ * queries this is the AABB face normal (axis-aligned), which is exact
43
+ * for AABB-shaped colliders and a stable approximation otherwise.
44
+ * @readonly
45
+ * @type {Vector3}
46
+ */
47
+ readonly normal: Vector3;
48
+ /**
49
+ * Parametric distance from the query origin to {@link position}, in
50
+ * the same units as the input direction's magnitude (so for a unit-
51
+ * length ray direction this is metres).
52
+ * @type {number}
53
+ */
54
+ t: number;
55
+ /**
56
+ * Entity that owns the hit body, or `-1` if no body owns it.
57
+ * @type {number}
58
+ */
59
+ entity: number;
60
+ /**
61
+ * Packed body id (index << 8 | generation). Goes stale once the body
62
+ * is unlinked from the {@link PhysicsSystem}; prefer {@link entity}
63
+ * for any cross-frame use.
64
+ * @type {number}
65
+ */
66
+ body_id: number;
67
+ /**
68
+ * Reset to a "no hit" state. Optional — the query convention is that the
69
+ * fields are only meaningful when the call returns `true`, so callers
70
+ * that always branch on the return value don't need to reset. Useful for
71
+ * debugger inspection and for tests that want to verify the query
72
+ * doesn't accidentally touch the result on miss.
73
+ */
74
+ reset(): void;
75
+ /**
76
+ * Fast type-check marker.
77
+ * @readonly
78
+ * @type {boolean}
79
+ */
80
+ readonly isPhysicsSurfacePoint: boolean;
81
+ }
82
+ import Vector3 from "../../../core/geom/Vector3.js";
83
+ //# sourceMappingURL=PhysicsSurfacePoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhysicsSurfacePoint.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/PhysicsSurfacePoint.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IAGQ;;;;OAIG;IACH,mBAFU,OAAO,CAEY;IAE7B;;;;;;OAMG;IACH,iBAFU,OAAO,CAEU;IAE3B;;;;;OAKG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,MAAM,CAEA;IAEhB;;;;;OAKG;IACH,SAFU,MAAM,CAEC;IAGrB;;;;;;OAMG;IACH,cAQC;IAGL;;;;OAIG;IACH,gCAFU,OAAO,CAEkC;CAPlD;oBA5FmB,+BAA+B"}
@@ -0,0 +1,100 @@
1
+ import Vector3 from "../../../core/geom/Vector3.js";
2
+
3
+ /**
4
+ * Result of a {@link PhysicsSystem} query that resolves to a single surface
5
+ * contact — raycast hit, sphere overlap nearest-point, shape-cast first
6
+ * blocker, etc.
7
+ *
8
+ * The class is an *output parameter*: callers pre-allocate one (or pull one
9
+ * from a frame-pool) and pass it into the query. The query writes the fields
10
+ * on hit and returns `true`; on miss it returns `false` and leaves the
11
+ * fields untouched.
12
+ *
13
+ * Pre-allocation matters because a query that gets called every frame (a
14
+ * ground sensor, a hover beam) would otherwise drop a small object on the
15
+ * GC per call. Reusing the same `PhysicsSurfacePoint` keeps that allocation
16
+ * out of the hot path.
17
+ *
18
+ * Field layout chosen to match what gameplay code typically needs:
19
+ * - `position` — world-space point on the surface
20
+ * - `normal` — surface normal at that point (broadphase queries return
21
+ * the AABB face normal as an approximation; narrowphase-refined queries
22
+ * would return the true shape normal at the same call site)
23
+ * - `t` — distance along the input ray, sphere-cast, etc. Useful when the
24
+ * caller wants to interpolate or step along the query primitive
25
+ * (`origin + t·direction` reconstructs the hit point exactly without
26
+ * reading `position`, which the deferred-execution physics events bus
27
+ * would otherwise need to copy).
28
+ * - `entity` — entity id that owns the hit body
29
+ * - `body_id` — packed body id (index << 8 | generation); stale after the
30
+ * body is unlinked, so prefer `entity` for any cross-frame retention.
31
+ *
32
+ * @author Alex Goldring
33
+ * @copyright Company Named Limited (c) 2026
34
+ */
35
+ export class PhysicsSurfacePoint {
36
+
37
+ constructor() {
38
+ /**
39
+ * World-space point on the hit surface.
40
+ * @readonly
41
+ * @type {Vector3}
42
+ */
43
+ this.position = new Vector3();
44
+
45
+ /**
46
+ * Surface normal at {@link position}, unit length. For broadphase-only
47
+ * queries this is the AABB face normal (axis-aligned), which is exact
48
+ * for AABB-shaped colliders and a stable approximation otherwise.
49
+ * @readonly
50
+ * @type {Vector3}
51
+ */
52
+ this.normal = new Vector3();
53
+
54
+ /**
55
+ * Parametric distance from the query origin to {@link position}, in
56
+ * the same units as the input direction's magnitude (so for a unit-
57
+ * length ray direction this is metres).
58
+ * @type {number}
59
+ */
60
+ this.t = 0;
61
+
62
+ /**
63
+ * Entity that owns the hit body, or `-1` if no body owns it.
64
+ * @type {number}
65
+ */
66
+ this.entity = -1;
67
+
68
+ /**
69
+ * Packed body id (index << 8 | generation). Goes stale once the body
70
+ * is unlinked from the {@link PhysicsSystem}; prefer {@link entity}
71
+ * for any cross-frame use.
72
+ * @type {number}
73
+ */
74
+ this.body_id = -1;
75
+ }
76
+
77
+ /**
78
+ * Reset to a "no hit" state. Optional — the query convention is that the
79
+ * fields are only meaningful when the call returns `true`, so callers
80
+ * that always branch on the return value don't need to reset. Useful for
81
+ * debugger inspection and for tests that want to verify the query
82
+ * doesn't accidentally touch the result on miss.
83
+ */
84
+ reset() {
85
+ const p = this.position;
86
+ const n = this.normal;
87
+ p[0] = 0; p[1] = 0; p[2] = 0;
88
+ n[0] = 0; n[1] = 0; n[2] = 0;
89
+ this.t = 0;
90
+ this.entity = -1;
91
+ this.body_id = -1;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Fast type-check marker.
97
+ * @readonly
98
+ * @type {boolean}
99
+ */
100
+ PhysicsSurfacePoint.prototype.isPhysicsSurfacePoint = true;