@woosh/meep-engine 2.168.0 → 2.169.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 (295) hide show
  1. package/README.md +2 -2
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/package.json +1 -1
  4. package/src/REVIEW_2026_08_06/adv-core.md +511 -0
  5. package/src/REVIEW_2026_08_06/adv-gfx.md +480 -0
  6. package/src/REVIEW_2026_08_06/adv-view.md +446 -0
  7. package/src/REVIEW_2026_08_06/api-core.md +296 -0
  8. package/src/REVIEW_2026_08_06/api-engine.md +195 -0
  9. package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +507 -0
  10. package/src/REVIEW_2026_08_06/core-binary.md +348 -0
  11. package/src/REVIEW_2026_08_06/core-collection.md +376 -0
  12. package/src/REVIEW_2026_08_06/core-math.md +221 -0
  13. package/src/REVIEW_2026_08_06/core-process.md +266 -0
  14. package/src/REVIEW_2026_08_06/core-science.md +223 -0
  15. package/src/REVIEW_2026_08_06/engine-ai-nav.md +279 -0
  16. package/src/REVIEW_2026_08_06/engine-animation.md +167 -0
  17. package/src/REVIEW_2026_08_06/engine-asset.md +166 -0
  18. package/src/REVIEW_2026_08_06/engine-ecs.md +920 -0
  19. package/src/REVIEW_2026_08_06/engine-input.md +197 -0
  20. package/src/REVIEW_2026_08_06/engine-misc.md +248 -0
  21. package/src/REVIEW_2026_08_06/engine-terrain.md +52 -0
  22. package/src/REVIEW_2026_08_06/generation.md +176 -0
  23. package/src/REVIEW_2026_08_06/geom-2d.md +434 -0
  24. package/src/REVIEW_2026_08_06/geom-3d.md +117 -0
  25. package/src/REVIEW_2026_08_06/gfx-gi.md +143 -0
  26. package/src/REVIEW_2026_08_06/gfx-render.md +740 -0
  27. package/src/REVIEW_2026_08_06/gfx-texture.md +690 -0
  28. package/src/REVIEW_2026_08_06/prior-criticals.md +49 -0
  29. package/src/REVIEW_2026_08_06/prior-highs.md +138 -0
  30. package/src/REVIEW_2026_08_06/test-gaps.md +364 -0
  31. package/src/REVIEW_2026_08_06/view.md +667 -0
  32. package/src/REVIEW_2026_08_06.md +571 -0
  33. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  34. package/src/core/binary/BinaryBuffer.js +12 -1
  35. package/src/core/binary/BitImage2.d.ts +5 -1
  36. package/src/core/binary/BitImage2.d.ts.map +1 -1
  37. package/src/core/binary/BitImage2.js +5 -1
  38. package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -1
  39. package/src/core/bvh8/build/NodeProxy.js +314 -308
  40. package/src/core/collection/list/List.d.ts +15 -0
  41. package/src/core/collection/list/List.d.ts.map +1 -1
  42. package/src/core/collection/list/List.js +34 -0
  43. package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
  44. package/src/core/collection/list/SortedListProjection.js +4 -1
  45. package/src/core/collection/map/BiMap.d.ts +25 -2
  46. package/src/core/collection/map/BiMap.d.ts.map +1 -1
  47. package/src/core/collection/map/BiMap.js +57 -3
  48. package/src/core/debug/matchers/IsAnything.d.ts.map +1 -1
  49. package/src/core/debug/matchers/IsAnything.js +5 -1
  50. package/src/core/events/signal/Signal.d.ts.map +1 -1
  51. package/src/core/events/signal/Signal.js +3 -1
  52. package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +433 -0
  53. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts +31 -0
  54. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts.map +1 -0
  55. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js +84 -0
  56. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts +24 -2
  57. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts.map +1 -1
  58. package/src/core/geom/2d/polygon/polygon2_signed_area.js +52 -34
  59. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +28 -0
  60. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +1 -0
  61. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +86 -0
  62. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts +40 -0
  63. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts.map +1 -0
  64. package/src/core/geom/2d/polygon/polygon2_triangulate.js +1280 -0
  65. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts +28 -0
  66. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts.map +1 -0
  67. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.js +77 -0
  68. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +6 -3
  69. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -1
  70. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +26 -13
  71. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts +17 -1
  72. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts.map +1 -1
  73. package/src/core/geom/2d/triangle/tri2_signed_area.js +35 -23
  74. package/src/core/geom/2d/v2_morton_encode.d.ts +20 -0
  75. package/src/core/geom/2d/v2_morton_encode.d.ts.map +1 -0
  76. package/src/core/geom/2d/v2_morton_encode.js +23 -0
  77. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -1
  78. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +4 -1
  79. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts +27 -0
  80. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts.map +1 -0
  81. package/src/core/geom/3d/polygon/polygon3_compute_normal.js +60 -0
  82. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts +34 -0
  83. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts.map +1 -0
  84. package/src/core/geom/3d/polygon/polygon3_triangulate.js +94 -0
  85. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +8 -2
  86. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
  87. package/src/core/geom/3d/quaternion/quat3_multiply.js +8 -2
  88. package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
  89. package/src/core/geom/3d/shape/ConvexHullShape3D.js +32 -2
  90. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +23 -6
  91. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -1
  92. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +268 -124
  93. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts +17 -0
  94. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts.map +1 -0
  95. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js +44 -0
  96. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts +20 -0
  97. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts.map +1 -0
  98. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js +40 -0
  99. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts +19 -0
  100. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts.map +1 -0
  101. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.js +34 -0
  102. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts +22 -0
  103. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts.map +1 -0
  104. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.js +37 -0
  105. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts +87 -0
  106. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts.map +1 -0
  107. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.js +599 -0
  108. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts +32 -0
  109. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts.map +1 -1
  110. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.js +66 -7
  111. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts +22 -1
  112. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts.map +1 -1
  113. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js +83 -38
  114. package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +554 -0
  115. package/src/core/geom/vec3/v3_cotangent.d.ts +6 -2
  116. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -1
  117. package/src/core/geom/vec3/v3_cotangent.js +6 -2
  118. package/src/core/geom/vec3/v3_cross.d.ts +6 -2
  119. package/src/core/geom/vec3/v3_cross.d.ts.map +1 -1
  120. package/src/core/geom/vec3/v3_cross.js +6 -2
  121. package/src/core/geom/vec3/v3_multiply.d.ts +6 -2
  122. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -1
  123. package/src/core/geom/vec3/v3_multiply.js +6 -2
  124. package/src/core/geom/vec3/v3_subtract.d.ts +6 -2
  125. package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -1
  126. package/src/core/geom/vec3/v3_subtract.js +6 -2
  127. package/src/core/localization/Localization.js +1 -1
  128. package/src/core/math/random/randomSeed.d.ts +13 -0
  129. package/src/core/math/random/randomSeed.d.ts.map +1 -0
  130. package/src/core/math/random/randomSeed.js +16 -0
  131. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts +50 -0
  132. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts.map +1 -0
  133. package/src/core/math/spline/spline3_hermite_apply_transform.js +107 -0
  134. package/src/core/math/spline/spline3_hermite_reverse.d.ts +34 -0
  135. package/src/core/math/spline/spline3_hermite_reverse.d.ts.map +1 -0
  136. package/src/core/math/spline/spline3_hermite_reverse.js +49 -0
  137. package/src/core/math/statistics/hammersley_sequence.d.ts +17 -4
  138. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -1
  139. package/src/core/math/statistics/hammersley_sequence.js +25 -16
  140. package/src/core/process/Future.d.ts.map +1 -1
  141. package/src/core/process/Future.js +12 -0
  142. package/src/core/process/PromiseWatcher.d.ts.map +1 -1
  143. package/src/core/process/PromiseWatcher.js +9 -2
  144. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  145. package/src/core/process/executor/ConcurrentExecutor.js +12 -2
  146. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  147. package/src/core/process/worker/WorkerProxy.js +5 -2
  148. package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
  149. package/src/core/process/worker/extractTransferables.js +4 -1
  150. package/src/engine/Engine.d.ts +12 -12
  151. package/src/engine/Engine.d.ts.map +1 -1
  152. package/src/engine/Engine.js +149 -10
  153. package/src/engine/EngineHarness.d.ts.map +1 -1
  154. package/src/engine/EngineHarness.js +4 -1
  155. package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
  156. package/src/engine/asset/loaders/ArrayBufferLoader.js +7 -0
  157. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.d.ts.map +1 -1
  158. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +3 -1
  159. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts.map +1 -1
  160. package/src/engine/ecs/terrain/ecs/TerrainSystem.js +4 -1
  161. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +29 -0
  162. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  163. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +84 -23
  164. package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +446 -0
  165. package/src/engine/graphics/GraphicsEngine.d.ts +56 -7
  166. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  167. package/src/engine/graphics/GraphicsEngine.js +196 -24
  168. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts +9 -0
  169. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts.map +1 -0
  170. package/src/engine/graphics/context/WebGLContextFailureReason.js +17 -0
  171. package/src/engine/graphics/context/WebGLContextMonitor.d.ts +106 -0
  172. package/src/engine/graphics/context/WebGLContextMonitor.d.ts.map +1 -0
  173. package/src/engine/graphics/context/WebGLContextMonitor.js +341 -0
  174. package/src/engine/graphics/context/WebGLContextState.d.ts +14 -0
  175. package/src/engine/graphics/context/WebGLContextState.d.ts.map +1 -0
  176. package/src/engine/graphics/context/WebGLContextState.js +24 -0
  177. package/src/engine/graphics/context/testWebGLContextLoss.d.ts +2 -0
  178. package/src/engine/graphics/context/testWebGLContextLoss.d.ts.map +1 -0
  179. package/src/engine/graphics/context/testWebGLContextLoss.js +696 -0
  180. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
  181. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +68 -32
  182. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts +14 -0
  183. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts.map +1 -0
  184. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.js +41 -0
  185. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +1 -1
  186. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  187. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +5 -0
  188. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +5 -1
  189. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
  190. package/src/engine/graphics/ecs/trail2d/Trail2D.js +15 -0
  191. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +1 -1
  192. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
  193. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +2 -1
  194. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +4 -1
  195. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
  196. package/src/engine/graphics/ecs/trail3d/Trail3D.js +488 -476
  197. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
  198. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
  199. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +280 -253
  200. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  201. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +3 -2
  202. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  203. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +3 -1
  204. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +1 -1
  205. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts +5 -0
  206. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts.map +1 -1
  207. package/src/engine/graphics/load_and_set_cubemap_v0.js +26 -21
  208. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  209. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +19 -8
  210. package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +1 -1
  211. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.d.ts.map +1 -1
  212. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +10 -3
  213. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  214. package/src/engine/graphics/texture/atlas/TextureAtlas.js +4 -1
  215. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.d.ts.map +1 -1
  216. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +11 -0
  217. package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts.map +1 -1
  218. package/src/engine/graphics/texture/cubemap/load_environment_map.js +5 -2
  219. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.d.ts.map +1 -1
  220. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +26 -18
  221. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts +15 -2
  222. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  223. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +29 -3
  224. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts +11 -1
  225. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts.map +1 -1
  226. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +158 -171
  227. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +1 -1
  228. package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +2 -2
  229. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.d.ts.map +1 -1
  230. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +10 -3
  231. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts +14 -0
  232. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts.map +1 -0
  233. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.js +38 -0
  234. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  235. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +433 -425
  236. package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
  237. package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
  238. package/src/engine/physics/constraint/solve_constraints.js +38 -13
  239. package/src/engine/physics/contact/ManifoldStore.d.ts +15 -3
  240. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
  241. package/src/engine/physics/contact/ManifoldStore.js +15 -3
  242. package/src/engine/physics/ecs/Joint.d.ts +7 -4
  243. package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
  244. package/src/engine/physics/ecs/Joint.js +7 -4
  245. package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -0
  246. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  247. package/src/engine/physics/ecs/PhysicsSystem.js +16 -0
  248. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  249. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  250. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +15 -7
  251. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
  252. package/src/engine/physics/narrowphase/convex_convex_manifold.js +33 -10
  253. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +6 -2
  254. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
  255. package/src/engine/physics/narrowphase/refine_ray_concave.js +6 -2
  256. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +6 -2
  257. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
  258. package/src/engine/physics/narrowphase/refine_ray_hit.js +6 -2
  259. package/src/engine/physics/queries/raycast.d.ts.map +1 -1
  260. package/src/engine/physics/queries/raycast.js +11 -4
  261. package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
  262. package/src/engine/save/storage/IndexedDBStorage.js +21 -3
  263. package/src/engine/simulation/Ticker.d.ts +12 -0
  264. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  265. package/src/engine/simulation/Ticker.js +18 -0
  266. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  267. package/src/engine/sound/simulation/AcousticSimulator.js +9 -1
  268. package/src/engine/sound/simulation/core/VolumeField.d.ts +6 -2
  269. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  270. package/src/engine/sound/simulation/core/VolumeField.js +6 -2
  271. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +6 -2
  272. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +1 -1
  273. package/src/engine/sound/simulation/probe/AcousticProbeField.js +6 -2
  274. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +6 -2
  275. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +1 -1
  276. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +6 -2
  277. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +3 -1
  278. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +1 -1
  279. package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +3 -1
  280. package/src/engine/ui/GUIEngine.d.ts.map +1 -1
  281. package/src/engine/ui/GUIEngine.js +8 -1
  282. package/src/generation/theme/TerrainTheme.d.ts.map +1 -1
  283. package/src/generation/theme/TerrainTheme.js +2 -1
  284. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  285. package/src/generation/theme/ThemeEngine.js +6 -5
  286. package/src/view/ViewGroup.d.ts.map +1 -1
  287. package/src/view/ViewGroup.js +9 -7
  288. package/src/view/graphics/WebGLContextFailureView.d.ts +19 -0
  289. package/src/view/graphics/WebGLContextFailureView.d.ts.map +1 -0
  290. package/src/view/graphics/WebGLContextFailureView.js +76 -0
  291. package/src/view/minimap/Minimap.d.ts +8 -0
  292. package/src/view/minimap/Minimap.d.ts.map +1 -1
  293. package/src/view/minimap/Minimap.js +16 -3
  294. package/src/view/minimap/dom/MinimapMarkerView.d.ts.map +1 -1
  295. package/src/view/minimap/dom/MinimapMarkerView.js +3 -1
@@ -3,6 +3,38 @@ const ONE_OVER_SIX = 1.0 / 6.0;
3
3
  /**
4
4
  * Compute signed volume of a tetrahedron with the last point at the origin
5
5
  * Triangle is defined by points A,B,C
6
+ *
7
+ * Evaluated as `p · ((q - p) × (r - p))` where `(p, q, r)` is the cyclic
8
+ * rotation of `(a, b, c)` that puts the vertex nearest the origin first. Both
9
+ * steps are exact rewrites of `a · (b × c)`: a cyclic rotation leaves a 3×3
10
+ * determinant unchanged, and the two extra terms the edge form introduces,
11
+ * `p · (q × p)` and `p · (p × r)`, are identically zero.
12
+ *
13
+ * The rotation is not cosmetic — the two forms fail in opposite regimes, and
14
+ * picking the apex is what makes the result well conditioned in both. The
15
+ * error behaves like `eps · |p| · |q - p| · |r - p|`:
16
+ *
17
+ * - the expanded determinant of absolute coordinates loses everything for a
18
+ * SMALL triangle FAR from the origin. Summed over a unit cube translated to
19
+ * (1e6, 1e6, 1e6) it returned 256, and −262144 at 1e7;
20
+ * - anchoring unconditionally on `a` instead loses everything for a LARGE
21
+ * triangle reaching IN toward the origin, where `|b - a|` and `|c - a|` are
22
+ * both as large as `|a|`. `(1e8, 1e8, 1e8), (1, 0, 0), (0, 1, 0)` returned
23
+ * 0 for a true volume of 16666666.67, and flipped the sign of a needle
24
+ * tetrahedron often enough to break callers using this as an orientation
25
+ * predicate.
26
+ *
27
+ * Anchoring on the vertex nearest the origin is exact in both, and measured at
28
+ * a worst relative error of 8e-13 over 400k triangles with each vertex drawn
29
+ * from an independent magnitude decade up to 1e9.
30
+ *
31
+ * Distance is compared by largest absolute component rather than by squared
32
+ * length, which is cheaper and cannot overflow for coordinates above ~1e154.
33
+ *
34
+ * A caller summing over a whole mesh should still subtract a reference point,
35
+ * as {@link tri3_mesh_compute_signed_volume} does: this conditions each term,
36
+ * but only the caller can stop the terms themselves from being enormous.
37
+ *
6
38
  * @see "EFFICIENT FEATURE EXTRACTION FOR 2D/3D OBJECTS IN MESH REPRESENTATION" by Cha Zhang and Tsuhan Chen
7
39
  * @param {number} ax
8
40
  * @param {number} ay
@@ -21,13 +53,40 @@ export function tri3_compute_signed_volume(
21
53
  cx, cy, cz
22
54
  ) {
23
55
 
24
- const v321 = cx * by * az;
25
- const v231 = bx * cy * az;
26
- const v312 = cx * ay * bz;
27
- const v132 = ax * cy * bz;
28
- const v213 = bx * ay * cz;
29
- const v123 = ax * by * cz;
56
+ const ea = Math.max(Math.abs(ax), Math.abs(ay), Math.abs(az));
57
+ const eb = Math.max(Math.abs(bx), Math.abs(by), Math.abs(bz));
58
+ const ec = Math.max(Math.abs(cx), Math.abs(cy), Math.abs(cz));
30
59
 
31
- return ONE_OVER_SIX * (-v321 + v231 + v312 - v132 - v213 + v123);
60
+ // (p, q, r) is a CYCLIC rotation of (a, b, c) swapping any two would
61
+ // negate the determinant.
62
+ let px, py, pz, qx, qy, qz, rx, ry, rz;
63
+
64
+ if (eb <= ea && eb <= ec) {
65
+ px = bx; py = by; pz = bz;
66
+ qx = cx; qy = cy; qz = cz;
67
+ rx = ax; ry = ay; rz = az;
68
+ } else if (ec <= ea && ec <= eb) {
69
+ px = cx; py = cy; pz = cz;
70
+ qx = ax; qy = ay; qz = az;
71
+ rx = bx; ry = by; rz = bz;
72
+ } else {
73
+ px = ax; py = ay; pz = az;
74
+ qx = bx; qy = by; qz = bz;
75
+ rx = cx; ry = cy; rz = cz;
76
+ }
77
+
78
+ const e1x = qx - px;
79
+ const e1y = qy - py;
80
+ const e1z = qz - pz;
81
+
82
+ const e2x = rx - px;
83
+ const e2y = ry - py;
84
+ const e2z = rz - pz;
85
+
86
+ const nx = e1y * e2z - e1z * e2y;
87
+ const ny = e1z * e2x - e1x * e2z;
88
+ const nz = e1x * e2y - e1y * e2x;
89
+
90
+ return ONE_OVER_SIX * (px * nx + py * ny + pz * nz);
32
91
 
33
92
  }
@@ -11,10 +11,31 @@
11
11
  * tetrahedralized version of the same closed surface should have a total tet
12
12
  * volume close to this value (small discretization gap aside).
13
13
  *
14
+ * Two things make the sum trustworthy away from the origin.
15
+ *
16
+ * The apex of every tetrahedron is the mesh's own first referenced vertex
17
+ * rather than the origin. For a closed mesh the total is invariant to that
18
+ * choice, but the conditioning is not: with the origin as apex, a mesh sitting
19
+ * at 1e7 produces per-triangle terms around 1e21 that must cancel down to the
20
+ * enclosed volume, and there is no precision left to cancel with. Anchored to
21
+ * the mesh itself, each term is on the scale of the mesh, not of its distance
22
+ * from the origin.
23
+ *
24
+ * The terms are then accumulated with Neumaier compensation, which recovers the
25
+ * low-order bits lost whenever a term is added to a running total of a very
26
+ * different magnitude — the situation for any shape whose bounding box dwarfs
27
+ * its volume, such as a thin shell.
28
+ *
29
+ * Note this changes what an OPEN mesh reports, which was already documented as
30
+ * not being an enclosed volume: the cone is now measured from the first
31
+ * referenced vertex instead of the origin, so the number is at least a property
32
+ * of the mesh rather than of where the mesh happens to be. For a closed mesh
33
+ * nothing changes but the accuracy.
34
+ *
14
35
  * @param {ArrayLike<number>} positions flat (x,y,z,…) array
15
36
  * @param {ArrayLike<number>} indices 3 entries per triangle
16
37
  * @returns {number} signed volume — positive for CCW-from-outside winding,
17
- * negative if flipped, zero for an open or self-cancelling mesh
38
+ * negative if flipped, zero for an empty or self-cancelling mesh
18
39
  */
19
40
  export function tri3_mesh_compute_signed_volume(positions: ArrayLike<number>, indices: ArrayLike<number>): number;
20
41
  //# sourceMappingURL=tri3_mesh_compute_signed_volume.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tri3_mesh_compute_signed_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,2DALW,UAAU,MAAM,CAAC,WACjB,UAAU,MAAM,CAAC,GACf,MAAM,CAoBlB"}
1
+ {"version":3,"file":"tri3_mesh_compute_signed_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2DALW,UAAU,MAAM,CAAC,WACjB,UAAU,MAAM,CAAC,GACf,MAAM,CA4ClB"}
@@ -1,38 +1,83 @@
1
- import { tri3_compute_signed_volume } from "./tri3_compute_signed_volume.js";
2
-
3
- /**
4
- * Compute the signed volume enclosed by a triangle surface mesh given as
5
- * flat positions + indices, via the divergence theorem.
6
- *
7
- * For every triangle (a, b, c) this sums the signed volume of the
8
- * tetrahedron (origin, a, b, c); when the mesh is closed and consistently
9
- * wound (CCW from outside → positive volume), the per-triangle contributions
10
- * cancel everywhere except inside the surface, leaving the enclosed volume.
11
- *
12
- * Useful as a ground truth for validating volumetric mesh generation: the
13
- * tetrahedralized version of the same closed surface should have a total tet
14
- * volume close to this value (small discretization gap aside).
15
- *
16
- * @param {ArrayLike<number>} positions flat (x,y,z,…) array
17
- * @param {ArrayLike<number>} indices 3 entries per triangle
18
- * @returns {number} signed volume positive for CCW-from-outside winding,
19
- * negative if flipped, zero for an open or self-cancelling mesh
20
- */
21
- export function tri3_mesh_compute_signed_volume(positions, indices) {
22
- let total = 0;
23
-
24
- const n = indices.length;
25
- for (let i = 0; i < n; i += 3) {
26
- const a3 = indices[i] * 3;
27
- const b3 = indices[i + 1] * 3;
28
- const c3 = indices[i + 2] * 3;
29
-
30
- total += tri3_compute_signed_volume(
31
- positions[a3], positions[a3 + 1], positions[a3 + 2],
32
- positions[b3], positions[b3 + 1], positions[b3 + 2],
33
- positions[c3], positions[c3 + 1], positions[c3 + 2],
34
- );
35
- }
36
-
37
- return total;
38
- }
1
+ import { tri3_compute_signed_volume } from "./tri3_compute_signed_volume.js";
2
+
3
+ /**
4
+ * Compute the signed volume enclosed by a triangle surface mesh given as
5
+ * flat positions + indices, via the divergence theorem.
6
+ *
7
+ * For every triangle (a, b, c) this sums the signed volume of the
8
+ * tetrahedron (origin, a, b, c); when the mesh is closed and consistently
9
+ * wound (CCW from outside → positive volume), the per-triangle contributions
10
+ * cancel everywhere except inside the surface, leaving the enclosed volume.
11
+ *
12
+ * Useful as a ground truth for validating volumetric mesh generation: the
13
+ * tetrahedralized version of the same closed surface should have a total tet
14
+ * volume close to this value (small discretization gap aside).
15
+ *
16
+ * Two things make the sum trustworthy away from the origin.
17
+ *
18
+ * The apex of every tetrahedron is the mesh's own first referenced vertex
19
+ * rather than the origin. For a closed mesh the total is invariant to that
20
+ * choice, but the conditioning is not: with the origin as apex, a mesh sitting
21
+ * at 1e7 produces per-triangle terms around 1e21 that must cancel down to the
22
+ * enclosed volume, and there is no precision left to cancel with. Anchored to
23
+ * the mesh itself, each term is on the scale of the mesh, not of its distance
24
+ * from the origin.
25
+ *
26
+ * The terms are then accumulated with Neumaier compensation, which recovers the
27
+ * low-order bits lost whenever a term is added to a running total of a very
28
+ * different magnitude the situation for any shape whose bounding box dwarfs
29
+ * its volume, such as a thin shell.
30
+ *
31
+ * Note this changes what an OPEN mesh reports, which was already documented as
32
+ * not being an enclosed volume: the cone is now measured from the first
33
+ * referenced vertex instead of the origin, so the number is at least a property
34
+ * of the mesh rather than of where the mesh happens to be. For a closed mesh
35
+ * nothing changes but the accuracy.
36
+ *
37
+ * @param {ArrayLike<number>} positions flat (x,y,z,…) array
38
+ * @param {ArrayLike<number>} indices 3 entries per triangle
39
+ * @returns {number} signed volume — positive for CCW-from-outside winding,
40
+ * negative if flipped, zero for an empty or self-cancelling mesh
41
+ */
42
+ export function tri3_mesh_compute_signed_volume(positions, indices) {
43
+ const n = indices.length;
44
+
45
+ if (n === 0) {
46
+ return 0;
47
+ }
48
+
49
+ // Anchor the tetrahedra at the mesh instead of at the origin.
50
+ const origin3 = indices[0] * 3;
51
+
52
+ const ox = positions[origin3];
53
+ const oy = positions[origin3 + 1];
54
+ const oz = positions[origin3 + 2];
55
+
56
+ let total = 0;
57
+ // Neumaier compensation: the bits that fell off the bottom of `total`.
58
+ let compensation = 0;
59
+
60
+ for (let i = 0; i < n; i += 3) {
61
+ const a3 = indices[i] * 3;
62
+ const b3 = indices[i + 1] * 3;
63
+ const c3 = indices[i + 2] * 3;
64
+
65
+ const term = tri3_compute_signed_volume(
66
+ positions[a3] - ox, positions[a3 + 1] - oy, positions[a3 + 2] - oz,
67
+ positions[b3] - ox, positions[b3 + 1] - oy, positions[b3 + 2] - oz,
68
+ positions[c3] - ox, positions[c3 + 1] - oy, positions[c3 + 2] - oz,
69
+ );
70
+
71
+ const sum = total + term;
72
+
73
+ if (Math.abs(total) >= Math.abs(term)) {
74
+ compensation += (total - sum) + term;
75
+ } else {
76
+ compensation += (term - sum) + total;
77
+ }
78
+
79
+ total = sum;
80
+ }
81
+
82
+ return total + compensation;
83
+ }