@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.
- package/README.md +2 -2
- package/build/bundle-worker-image-decoder.js +1 -1
- package/package.json +1 -1
- package/src/REVIEW_2026_08_06/adv-core.md +511 -0
- package/src/REVIEW_2026_08_06/adv-gfx.md +480 -0
- package/src/REVIEW_2026_08_06/adv-view.md +446 -0
- package/src/REVIEW_2026_08_06/api-core.md +296 -0
- package/src/REVIEW_2026_08_06/api-engine.md +195 -0
- package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +507 -0
- package/src/REVIEW_2026_08_06/core-binary.md +348 -0
- package/src/REVIEW_2026_08_06/core-collection.md +376 -0
- package/src/REVIEW_2026_08_06/core-math.md +221 -0
- package/src/REVIEW_2026_08_06/core-process.md +266 -0
- package/src/REVIEW_2026_08_06/core-science.md +223 -0
- package/src/REVIEW_2026_08_06/engine-ai-nav.md +279 -0
- package/src/REVIEW_2026_08_06/engine-animation.md +167 -0
- package/src/REVIEW_2026_08_06/engine-asset.md +166 -0
- package/src/REVIEW_2026_08_06/engine-ecs.md +920 -0
- package/src/REVIEW_2026_08_06/engine-input.md +197 -0
- package/src/REVIEW_2026_08_06/engine-misc.md +248 -0
- package/src/REVIEW_2026_08_06/engine-terrain.md +52 -0
- package/src/REVIEW_2026_08_06/generation.md +176 -0
- package/src/REVIEW_2026_08_06/geom-2d.md +434 -0
- package/src/REVIEW_2026_08_06/geom-3d.md +117 -0
- package/src/REVIEW_2026_08_06/gfx-gi.md +143 -0
- package/src/REVIEW_2026_08_06/gfx-render.md +740 -0
- package/src/REVIEW_2026_08_06/gfx-texture.md +690 -0
- package/src/REVIEW_2026_08_06/prior-criticals.md +49 -0
- package/src/REVIEW_2026_08_06/prior-highs.md +138 -0
- package/src/REVIEW_2026_08_06/test-gaps.md +364 -0
- package/src/REVIEW_2026_08_06/view.md +667 -0
- package/src/REVIEW_2026_08_06.md +571 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +12 -1
- package/src/core/binary/BitImage2.d.ts +5 -1
- package/src/core/binary/BitImage2.d.ts.map +1 -1
- package/src/core/binary/BitImage2.js +5 -1
- package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -1
- package/src/core/bvh8/build/NodeProxy.js +314 -308
- package/src/core/collection/list/List.d.ts +15 -0
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +34 -0
- package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
- package/src/core/collection/list/SortedListProjection.js +4 -1
- package/src/core/collection/map/BiMap.d.ts +25 -2
- package/src/core/collection/map/BiMap.d.ts.map +1 -1
- package/src/core/collection/map/BiMap.js +57 -3
- package/src/core/debug/matchers/IsAnything.d.ts.map +1 -1
- package/src/core/debug/matchers/IsAnything.js +5 -1
- package/src/core/events/signal/Signal.d.ts.map +1 -1
- package/src/core/events/signal/Signal.js +3 -1
- package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +433 -0
- package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts +31 -0
- package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts.map +1 -0
- package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js +84 -0
- package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts +24 -2
- package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts.map +1 -1
- package/src/core/geom/2d/polygon/polygon2_signed_area.js +52 -34
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +28 -0
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +1 -0
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +86 -0
- package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts +40 -0
- package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts.map +1 -0
- package/src/core/geom/2d/polygon/polygon2_triangulate.js +1280 -0
- package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts +28 -0
- package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts.map +1 -0
- package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.js +77 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +6 -3
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -1
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +26 -13
- package/src/core/geom/2d/triangle/tri2_signed_area.d.ts +17 -1
- package/src/core/geom/2d/triangle/tri2_signed_area.d.ts.map +1 -1
- package/src/core/geom/2d/triangle/tri2_signed_area.js +35 -23
- package/src/core/geom/2d/v2_morton_encode.d.ts +20 -0
- package/src/core/geom/2d/v2_morton_encode.d.ts.map +1 -0
- package/src/core/geom/2d/v2_morton_encode.js +23 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -1
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +4 -1
- package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts +27 -0
- package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts.map +1 -0
- package/src/core/geom/3d/polygon/polygon3_compute_normal.js +60 -0
- package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts +34 -0
- package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts.map +1 -0
- package/src/core/geom/3d/polygon/polygon3_triangulate.js +94 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +8 -2
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_multiply.js +8 -2
- package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/ConvexHullShape3D.js +32 -2
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +23 -6
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +268 -124
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts +17 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js +44 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts +20 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js +40 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.js +34 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts +22 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.js +37 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts +87 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.js +599 -0
- package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts +32 -0
- package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/tri3_compute_signed_volume.js +66 -7
- package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts +22 -1
- package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js +83 -38
- package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +554 -0
- package/src/core/geom/vec3/v3_cotangent.d.ts +6 -2
- package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_cotangent.js +6 -2
- package/src/core/geom/vec3/v3_cross.d.ts +6 -2
- package/src/core/geom/vec3/v3_cross.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_cross.js +6 -2
- package/src/core/geom/vec3/v3_multiply.d.ts +6 -2
- package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_multiply.js +6 -2
- package/src/core/geom/vec3/v3_subtract.d.ts +6 -2
- package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_subtract.js +6 -2
- package/src/core/localization/Localization.js +1 -1
- package/src/core/math/random/randomSeed.d.ts +13 -0
- package/src/core/math/random/randomSeed.d.ts.map +1 -0
- package/src/core/math/random/randomSeed.js +16 -0
- package/src/core/math/spline/spline3_hermite_apply_transform.d.ts +50 -0
- package/src/core/math/spline/spline3_hermite_apply_transform.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_apply_transform.js +107 -0
- package/src/core/math/spline/spline3_hermite_reverse.d.ts +34 -0
- package/src/core/math/spline/spline3_hermite_reverse.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_reverse.js +49 -0
- package/src/core/math/statistics/hammersley_sequence.d.ts +17 -4
- package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -1
- package/src/core/math/statistics/hammersley_sequence.js +25 -16
- package/src/core/process/Future.d.ts.map +1 -1
- package/src/core/process/Future.js +12 -0
- package/src/core/process/PromiseWatcher.d.ts.map +1 -1
- package/src/core/process/PromiseWatcher.js +9 -2
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +12 -2
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +5 -2
- package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
- package/src/core/process/worker/extractTransferables.js +4 -1
- package/src/engine/Engine.d.ts +12 -12
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +149 -10
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +4 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.js +7 -0
- package/src/engine/ecs/speaker/lines/sets/LineSetDescription.d.ts.map +1 -1
- package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +3 -1
- package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/TerrainSystem.js +4 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +29 -0
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +84 -23
- package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +446 -0
- package/src/engine/graphics/GraphicsEngine.d.ts +56 -7
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +196 -24
- package/src/engine/graphics/context/WebGLContextFailureReason.d.ts +9 -0
- package/src/engine/graphics/context/WebGLContextFailureReason.d.ts.map +1 -0
- package/src/engine/graphics/context/WebGLContextFailureReason.js +17 -0
- package/src/engine/graphics/context/WebGLContextMonitor.d.ts +106 -0
- package/src/engine/graphics/context/WebGLContextMonitor.d.ts.map +1 -0
- package/src/engine/graphics/context/WebGLContextMonitor.js +341 -0
- package/src/engine/graphics/context/WebGLContextState.d.ts +14 -0
- package/src/engine/graphics/context/WebGLContextState.d.ts.map +1 -0
- package/src/engine/graphics/context/WebGLContextState.js +24 -0
- package/src/engine/graphics/context/testWebGLContextLoss.d.ts +2 -0
- package/src/engine/graphics/context/testWebGLContextLoss.d.ts.map +1 -0
- package/src/engine/graphics/context/testWebGLContextLoss.js +696 -0
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +68 -32
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts +14 -0
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.js +41 -0
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +5 -0
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +5 -1
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2D.js +15 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +2 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +4 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.js +488 -476
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +280 -253
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +3 -2
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +3 -1
- package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +1 -1
- package/src/engine/graphics/load_and_set_cubemap_v0.d.ts +5 -0
- package/src/engine/graphics/load_and_set_cubemap_v0.d.ts.map +1 -1
- package/src/engine/graphics/load_and_set_cubemap_v0.js +26 -21
- package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/group/ParticleGroup.js +19 -8
- package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +1 -1
- package/src/engine/graphics/texture/atlas/AtlasLookupTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +10 -3
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +4 -1
- package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +11 -0
- package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts.map +1 -1
- package/src/engine/graphics/texture/cubemap/load_environment_map.js +5 -2
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +26 -18
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts +15 -2
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +29 -3
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts +11 -1
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +158 -171
- package/src/engine/graphics/texture/sampler/sampler2d_paint.js +1 -1
- package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +2 -2
- package/src/engine/input/ecs/util/TopDownCameraControllerHelper.d.ts.map +1 -1
- package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +10 -3
- package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts +14 -0
- package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts.map +1 -0
- package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.js +38 -0
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +433 -425
- package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +38 -13
- package/src/engine/physics/contact/ManifoldStore.d.ts +15 -3
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +15 -3
- package/src/engine/physics/ecs/Joint.d.ts +7 -4
- package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
- package/src/engine/physics/ecs/Joint.js +7 -4
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +16 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +15 -7
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +33 -10
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +6 -2
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +6 -2
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +6 -2
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +6 -2
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +11 -4
- package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
- package/src/engine/save/storage/IndexedDBStorage.js +21 -3
- package/src/engine/simulation/Ticker.d.ts +12 -0
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +18 -0
- package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
- package/src/engine/sound/simulation/AcousticSimulator.js +9 -1
- package/src/engine/sound/simulation/core/VolumeField.d.ts +6 -2
- package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
- package/src/engine/sound/simulation/core/VolumeField.js +6 -2
- package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +6 -2
- package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +1 -1
- package/src/engine/sound/simulation/probe/AcousticProbeField.js +6 -2
- package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +6 -2
- package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +1 -1
- package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +6 -2
- package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +3 -1
- package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +1 -1
- package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +3 -1
- package/src/engine/ui/GUIEngine.d.ts.map +1 -1
- package/src/engine/ui/GUIEngine.js +8 -1
- package/src/generation/theme/TerrainTheme.d.ts.map +1 -1
- package/src/generation/theme/TerrainTheme.js +2 -1
- package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
- package/src/generation/theme/ThemeEngine.js +6 -5
- package/src/view/ViewGroup.d.ts.map +1 -1
- package/src/view/ViewGroup.js +9 -7
- package/src/view/graphics/WebGLContextFailureView.d.ts +19 -0
- package/src/view/graphics/WebGLContextFailureView.d.ts.map +1 -0
- package/src/view/graphics/WebGLContextFailureView.js +76 -0
- package/src/view/minimap/Minimap.d.ts +8 -0
- package/src/view/minimap/Minimap.d.ts.map +1 -1
- package/src/view/minimap/Minimap.js +16 -3
- package/src/view/minimap/dom/MinimapMarkerView.d.ts.map +1 -1
- package/src/view/minimap/dom/MinimapMarkerView.js +3 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relative area error of a triangulation produced by {@link polygon2_triangulate}
|
|
3
|
+
* for the same `points` / `contour_ends` / `contour_count`.
|
|
4
|
+
*
|
|
5
|
+
* `0` means the triangles cover exactly the polygon's area. A positive value is
|
|
6
|
+
* the fraction of the polygon that is missing (or, for a self-intersecting input,
|
|
7
|
+
* double-covered). This is the cheap, total-order way to ask "did that work?"
|
|
8
|
+
* without pairwise triangle comparisons -- it is the primary invariant the specs
|
|
9
|
+
* assert, and it is available to callers that need to validate untrusted input at
|
|
10
|
+
* runtime.
|
|
11
|
+
*
|
|
12
|
+
* A degenerate polygon (zero total area) reports `0` when the triangulation is
|
|
13
|
+
* also empty, and `Infinity` when it is not -- there is no meaningful ratio to a
|
|
14
|
+
* zero reference, and silently reporting `0` would call a wrong answer perfect.
|
|
15
|
+
*
|
|
16
|
+
* @param {ArrayLike<number>} result triangle indices as written by {@link polygon2_triangulate}
|
|
17
|
+
* @param {number} result_offset first index of the triangulation within `result`
|
|
18
|
+
* @param {number} triangle_count as returned by {@link polygon2_triangulate}
|
|
19
|
+
* @param {ArrayLike<number>} points flat (x, y) pairs, stride 2
|
|
20
|
+
* @param {ArrayLike<number>} contour_ends exclusive end vertex index per contour
|
|
21
|
+
* @param {number} contour_count
|
|
22
|
+
* @returns {number} relative area error, `0` for an exact triangulation
|
|
23
|
+
*
|
|
24
|
+
* @author Alex Goldring
|
|
25
|
+
* @copyright Company Named Limited (c) 2026
|
|
26
|
+
*/
|
|
27
|
+
export function polygon2_triangulation_deviation(result: ArrayLike<number>, result_offset: number, triangle_count: number, points: ArrayLike<number>, contour_ends: ArrayLike<number>, contour_count: number): number;
|
|
28
|
+
//# sourceMappingURL=polygon2_triangulation_deviation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon2_triangulation_deviation.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_triangulation_deviation.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,yDAXW,UAAU,MAAM,CAAC,iBACjB,MAAM,kBACN,MAAM,UACN,UAAU,MAAM,CAAC,gBACjB,UAAU,MAAM,CAAC,iBACjB,MAAM,GACJ,MAAM,CAoDlB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { tri2_signed_area } from "../triangle/tri2_signed_area.js";
|
|
2
|
+
import { polygon2_signed_area } from "./polygon2_signed_area.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Relative area error of a triangulation produced by {@link polygon2_triangulate}
|
|
6
|
+
* for the same `points` / `contour_ends` / `contour_count`.
|
|
7
|
+
*
|
|
8
|
+
* `0` means the triangles cover exactly the polygon's area. A positive value is
|
|
9
|
+
* the fraction of the polygon that is missing (or, for a self-intersecting input,
|
|
10
|
+
* double-covered). This is the cheap, total-order way to ask "did that work?"
|
|
11
|
+
* without pairwise triangle comparisons -- it is the primary invariant the specs
|
|
12
|
+
* assert, and it is available to callers that need to validate untrusted input at
|
|
13
|
+
* runtime.
|
|
14
|
+
*
|
|
15
|
+
* A degenerate polygon (zero total area) reports `0` when the triangulation is
|
|
16
|
+
* also empty, and `Infinity` when it is not -- there is no meaningful ratio to a
|
|
17
|
+
* zero reference, and silently reporting `0` would call a wrong answer perfect.
|
|
18
|
+
*
|
|
19
|
+
* @param {ArrayLike<number>} result triangle indices as written by {@link polygon2_triangulate}
|
|
20
|
+
* @param {number} result_offset first index of the triangulation within `result`
|
|
21
|
+
* @param {number} triangle_count as returned by {@link polygon2_triangulate}
|
|
22
|
+
* @param {ArrayLike<number>} points flat (x, y) pairs, stride 2
|
|
23
|
+
* @param {ArrayLike<number>} contour_ends exclusive end vertex index per contour
|
|
24
|
+
* @param {number} contour_count
|
|
25
|
+
* @returns {number} relative area error, `0` for an exact triangulation
|
|
26
|
+
*
|
|
27
|
+
* @author Alex Goldring
|
|
28
|
+
* @copyright Company Named Limited (c) 2026
|
|
29
|
+
*/
|
|
30
|
+
export function polygon2_triangulation_deviation(
|
|
31
|
+
result, result_offset, triangle_count,
|
|
32
|
+
points, contour_ends, contour_count
|
|
33
|
+
) {
|
|
34
|
+
// Outer contour area, minus every hole's.
|
|
35
|
+
let polygon_area = 0;
|
|
36
|
+
|
|
37
|
+
for (let c = 0; c < contour_count; c++) {
|
|
38
|
+
const from = c === 0 ? 0 : contour_ends[c - 1];
|
|
39
|
+
const to = contour_ends[c];
|
|
40
|
+
|
|
41
|
+
const count = to - from;
|
|
42
|
+
|
|
43
|
+
if (count < 3) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const slice = from === 0
|
|
48
|
+
? points
|
|
49
|
+
: (typeof points.subarray === "function" ? points.subarray(from * 2) : points.slice(from * 2));
|
|
50
|
+
|
|
51
|
+
const area = Math.abs(polygon2_signed_area(slice, count));
|
|
52
|
+
|
|
53
|
+
polygon_area += c === 0 ? area : -area;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let triangles_area = 0;
|
|
57
|
+
|
|
58
|
+
for (let t = 0; t < triangle_count; t++) {
|
|
59
|
+
const o = result_offset + t * 3;
|
|
60
|
+
|
|
61
|
+
const a = result[o] * 2;
|
|
62
|
+
const b = result[o + 1] * 2;
|
|
63
|
+
const c = result[o + 2] * 2;
|
|
64
|
+
|
|
65
|
+
triangles_area += Math.abs(tri2_signed_area(
|
|
66
|
+
points[a], points[a + 1],
|
|
67
|
+
points[b], points[b + 1],
|
|
68
|
+
points[c], points[c + 1]
|
|
69
|
+
));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (polygon_area === 0) {
|
|
73
|
+
return triangles_area === 0 ? 0 : Infinity;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return Math.abs(triangles_area - polygon_area) / Math.abs(polygon_area);
|
|
77
|
+
}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* candidate cell square.
|
|
7
7
|
*
|
|
8
8
|
* @param {{width:number, height:number, set:(x:number,y:number)=>void}} image
|
|
9
|
-
* @param {number} x0
|
|
10
|
-
* @param {number}
|
|
11
|
-
* @param {number}
|
|
9
|
+
* @param {number} x0
|
|
10
|
+
* @param {number} y0
|
|
11
|
+
* @param {number} x1
|
|
12
|
+
* @param {number} y1
|
|
13
|
+
* @param {number} x2
|
|
14
|
+
* @param {number} y2
|
|
12
15
|
*/
|
|
13
16
|
export function tri2_rasterize_conservative(image: {
|
|
14
17
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tri2_rasterize_conservative.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/triangle/tri2_rasterize_conservative.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tri2_rasterize_conservative.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/triangle/tri2_rasterize_conservative.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;WARkB,MAAM;YAAS,MAAM;aAAS,MAAM,KAAG,MAAM,KAAG,IAAI;OAC3D,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAoBhB"}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* candidate cell square.
|
|
7
7
|
*
|
|
8
8
|
* @param {{width:number, height:number, set:(x:number,y:number)=>void}} image
|
|
9
|
-
* @param {number} x0
|
|
10
|
-
* @param {number}
|
|
11
|
-
* @param {number}
|
|
9
|
+
* @param {number} x0
|
|
10
|
+
* @param {number} y0
|
|
11
|
+
* @param {number} x1
|
|
12
|
+
* @param {number} y1
|
|
13
|
+
* @param {number} x2
|
|
14
|
+
* @param {number} y2
|
|
12
15
|
*/
|
|
13
16
|
export function tri2_rasterize_conservative(image, x0, y0, x1, y1, x2, y2) {
|
|
14
17
|
let min_x = Math.floor(Math.min(x0, x1, x2));
|
|
@@ -33,11 +36,16 @@ export function tri2_rasterize_conservative(image, x0, y0, x1, y1, x2, y2) {
|
|
|
33
36
|
/**
|
|
34
37
|
* Separating-axis overlap test between a triangle and an axis-aligned box.
|
|
35
38
|
*
|
|
36
|
-
* @param {number} ax
|
|
37
|
-
* @param {number}
|
|
38
|
-
* @param {number}
|
|
39
|
-
* @param {number}
|
|
40
|
-
* @param {number}
|
|
39
|
+
* @param {number} ax first triangle vertex x
|
|
40
|
+
* @param {number} ay first triangle vertex y
|
|
41
|
+
* @param {number} bx second triangle vertex x
|
|
42
|
+
* @param {number} by second triangle vertex y
|
|
43
|
+
* @param {number} cx third triangle vertex x
|
|
44
|
+
* @param {number} cy third triangle vertex y
|
|
45
|
+
* @param {number} bminx box minimum corner x
|
|
46
|
+
* @param {number} bminy box minimum corner y
|
|
47
|
+
* @param {number} bmaxx box maximum corner x
|
|
48
|
+
* @param {number} bmaxy box maximum corner y
|
|
41
49
|
* @returns {boolean} true if the triangle and box overlap
|
|
42
50
|
*/
|
|
43
51
|
function tri_box_overlap(ax, ay, bx, by, cx, cy, bminx, bminy, bmaxx, bmaxy) {
|
|
@@ -57,11 +65,16 @@ function tri_box_overlap(ax, ay, bx, by, cx, cy, bminx, bminy, bmaxx, bmaxy) {
|
|
|
57
65
|
* Does the outward normal of edge (p->q) separate the box from the triangle?
|
|
58
66
|
* `r` is the triangle's third vertex (to orient the normal inward).
|
|
59
67
|
*
|
|
60
|
-
* @param {number} px
|
|
61
|
-
* @param {number}
|
|
62
|
-
* @param {number}
|
|
63
|
-
* @param {number}
|
|
64
|
-
* @param {number}
|
|
68
|
+
* @param {number} px edge start vertex x
|
|
69
|
+
* @param {number} py edge start vertex y
|
|
70
|
+
* @param {number} qx edge end vertex x
|
|
71
|
+
* @param {number} qy edge end vertex y
|
|
72
|
+
* @param {number} rx triangle's third vertex x
|
|
73
|
+
* @param {number} ry triangle's third vertex y
|
|
74
|
+
* @param {number} bminx box minimum corner x
|
|
75
|
+
* @param {number} bminy box minimum corner y
|
|
76
|
+
* @param {number} bmaxx box maximum corner x
|
|
77
|
+
* @param {number} bmaxy box maximum corner y
|
|
65
78
|
* @returns {boolean} true if this edge's axis separates the box from the triangle
|
|
66
79
|
*/
|
|
67
80
|
function edge_separates(px, py, qx, qy, rx, ry, bminx, bminy, bmaxx, bmaxy) {
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Signed area of a 2D triangle. Positive for counter-clockwise winding, negative
|
|
3
|
+
* for clockwise, zero when the three points are collinear.
|
|
4
|
+
*
|
|
5
|
+
* The edge vectors are formed FIRST and only then crossed. The algebraically
|
|
6
|
+
* identical expanded form -- `(x0*y1 - y0*x1) + (x1*y2 - y1*x2) + (x2*y0 - y2*x0)`,
|
|
7
|
+
* which this used to compute -- sums three products of ABSOLUTE coordinates, each
|
|
8
|
+
* `O(|p|^2)`, to reach an answer that is only the area. Those terms then cancel,
|
|
9
|
+
* and for a small triangle, or one far from the origin, the computed value -- and
|
|
10
|
+
* worse, its SIGN -- is rounding noise. A 1e-9-sided triangle at (1, 1) has a true
|
|
11
|
+
* area of ~5e-19 against per-term rounding of ~1e-16; the expanded form returns
|
|
12
|
+
* exactly 0. The callers most exposed were the ones that only want the sign: the
|
|
13
|
+
* Polyanya funnel and the atlas parameterisation validity check.
|
|
14
|
+
*
|
|
15
|
+
* This form's error is proportional to the area rather than to the coordinates'
|
|
16
|
+
* magnitude. It is still floating point: for a decision that must be exact
|
|
17
|
+
* regardless of magnitude, use `orient2d_indexed`, which is adaptive-exact.
|
|
18
|
+
*
|
|
3
19
|
* @param {number} x0
|
|
4
20
|
* @param {number} y0
|
|
5
21
|
* @param {number} x1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tri2_signed_area.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/triangle/tri2_signed_area.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tri2_signed_area.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/triangle/tri2_signed_area.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAUlB"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Signed area of a 2D triangle. Positive for counter-clockwise winding, negative
|
|
3
|
+
* for clockwise, zero when the three points are collinear.
|
|
4
|
+
*
|
|
5
|
+
* The edge vectors are formed FIRST and only then crossed. The algebraically
|
|
6
|
+
* identical expanded form -- `(x0*y1 - y0*x1) + (x1*y2 - y1*x2) + (x2*y0 - y2*x0)`,
|
|
7
|
+
* which this used to compute -- sums three products of ABSOLUTE coordinates, each
|
|
8
|
+
* `O(|p|^2)`, to reach an answer that is only the area. Those terms then cancel,
|
|
9
|
+
* and for a small triangle, or one far from the origin, the computed value -- and
|
|
10
|
+
* worse, its SIGN -- is rounding noise. A 1e-9-sided triangle at (1, 1) has a true
|
|
11
|
+
* area of ~5e-19 against per-term rounding of ~1e-16; the expanded form returns
|
|
12
|
+
* exactly 0. The callers most exposed were the ones that only want the sign: the
|
|
13
|
+
* Polyanya funnel and the atlas parameterisation validity check.
|
|
14
|
+
*
|
|
15
|
+
* This form's error is proportional to the area rather than to the coordinates'
|
|
16
|
+
* magnitude. It is still floating point: for a decision that must be exact
|
|
17
|
+
* regardless of magnitude, use `orient2d_indexed`, which is adaptive-exact.
|
|
18
|
+
*
|
|
19
|
+
* @param {number} x0
|
|
20
|
+
* @param {number} y0
|
|
21
|
+
* @param {number} x1
|
|
22
|
+
* @param {number} y1
|
|
23
|
+
* @param {number} x2
|
|
24
|
+
* @param {number} y2
|
|
25
|
+
* @returns {number}
|
|
26
|
+
*/
|
|
27
|
+
export function tri2_signed_area(
|
|
28
|
+
x0, y0,
|
|
29
|
+
x1, y1,
|
|
30
|
+
x2, y2
|
|
31
|
+
) {
|
|
32
|
+
|
|
33
|
+
return ((x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0)) * 0.5;
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interleave two 16-bit integer coordinates into a 32-bit Morton (Z-order) code.
|
|
3
|
+
*
|
|
4
|
+
* The 2D counterpart of the {@link v3_morton_encode} family. Inputs above 16 bits
|
|
5
|
+
* are silently truncated by {@link split_by_2}'s masking, which is the same
|
|
6
|
+
* contract the 3D encoders carry: callers quantise into range first.
|
|
7
|
+
*
|
|
8
|
+
* Points close in Z-order are close in space, which is what makes a Z-sorted
|
|
9
|
+
* sequence usable as a cheap 1D proxy for a 2D range query -- the acceleration
|
|
10
|
+
* {@link polygon2_triangulate} uses to keep its point-in-ear test local.
|
|
11
|
+
*
|
|
12
|
+
* @param {number} x integer in [0, 65535]
|
|
13
|
+
* @param {number} y integer in [0, 65535]
|
|
14
|
+
* @returns {number} unsigned 32-bit Morton code
|
|
15
|
+
*
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Company Named Limited (c) 2026
|
|
18
|
+
*/
|
|
19
|
+
export function v2_morton_encode(x: number, y: number): number;
|
|
20
|
+
//# sourceMappingURL=v2_morton_encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2_morton_encode.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/v2_morton_encode.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAPW,MAAM,KACN,MAAM,GACJ,MAAM,CAOlB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { split_by_2 } from "../../binary/split_by_2.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interleave two 16-bit integer coordinates into a 32-bit Morton (Z-order) code.
|
|
5
|
+
*
|
|
6
|
+
* The 2D counterpart of the {@link v3_morton_encode} family. Inputs above 16 bits
|
|
7
|
+
* are silently truncated by {@link split_by_2}'s masking, which is the same
|
|
8
|
+
* contract the 3D encoders carry: callers quantise into range first.
|
|
9
|
+
*
|
|
10
|
+
* Points close in Z-order are close in space, which is what makes a Z-sorted
|
|
11
|
+
* sequence usable as a cheap 1D proxy for a 2D range query -- the acceleration
|
|
12
|
+
* {@link polygon2_triangulate} uses to keep its point-in-ear test local.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} x integer in [0, 65535]
|
|
15
|
+
* @param {number} y integer in [0, 65535]
|
|
16
|
+
* @returns {number} unsigned 32-bit Morton code
|
|
17
|
+
*
|
|
18
|
+
* @author Alex Goldring
|
|
19
|
+
* @copyright Company Named Limited (c) 2026
|
|
20
|
+
*/
|
|
21
|
+
export function v2_morton_encode(x, y) {
|
|
22
|
+
return (split_by_2(x) | (split_by_2(y) << 1)) >>> 0;
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas_merge_charts.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/segment/atlas_merge_charts.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qEAPW,UAAU,eACV,MAAM,cACN,YAAY;IAEK,WAAW,GAA5B,MAAM;IACJ;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,
|
|
1
|
+
{"version":3,"file":"atlas_merge_charts.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/segment/atlas_merge_charts.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qEAPW,UAAU,eACV,MAAM,cACN,YAAY;IAEK,WAAW,GAA5B,MAAM;IACJ;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAqFzD"}
|
|
@@ -52,7 +52,10 @@ export function atlas_merge_charts(mesh, face_chart, chart_count, face_areas, op
|
|
|
52
52
|
const parent = new Int32Array(chart_count);
|
|
53
53
|
for (let c = 0; c < chart_count; c++) parent[c] = c;
|
|
54
54
|
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* @param {number} x
|
|
57
|
+
* @returns {number} root with path compression
|
|
58
|
+
*/
|
|
56
59
|
function find(x) {
|
|
57
60
|
while (parent[x] !== x) {
|
|
58
61
|
parent[x] = parent[parent[x]];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Newell's method: the area-weighted normal of an arbitrary 3D polygon, written
|
|
3
|
+
* to `result` at `result_offset` as a unit vector.
|
|
4
|
+
*
|
|
5
|
+
* Unlike taking the cross product of the first three vertices
|
|
6
|
+
* (what {@link bt_mesh_compute_face_normals} does, correctly, for triangles),
|
|
7
|
+
* this is defined for any vertex count, is immune to a collinear or coincident
|
|
8
|
+
* leading triple, and for a non-planar polygon returns the normal of its
|
|
9
|
+
* best-fit plane rather than of one arbitrary corner. That is exactly what
|
|
10
|
+
* projecting an n-gon down to 2D needs.
|
|
11
|
+
*
|
|
12
|
+
* A polygon with no area -- fewer than three vertices, all collinear, or all
|
|
13
|
+
* coincident -- has no normal; `result` is then written as `(0, 0, 0)`, which
|
|
14
|
+
* callers can test with a length check. That is a real outcome of real data, not
|
|
15
|
+
* an error.
|
|
16
|
+
*
|
|
17
|
+
* @param {ArrayLike<number>} result
|
|
18
|
+
* @param {number} result_offset
|
|
19
|
+
* @param {ArrayLike<number>} points flat (x, y, z) triples, stride 3
|
|
20
|
+
* @param {number} from first vertex index of the contour
|
|
21
|
+
* @param {number} count number of vertices in the contour
|
|
22
|
+
*
|
|
23
|
+
* @author Alex Goldring
|
|
24
|
+
* @copyright Company Named Limited (c) 2026
|
|
25
|
+
*/
|
|
26
|
+
export function polygon3_compute_normal(result: ArrayLike<number>, result_offset: number, points: ArrayLike<number>, from: number, count: number): void;
|
|
27
|
+
//# sourceMappingURL=polygon3_compute_normal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon3_compute_normal.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/polygon/polygon3_compute_normal.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,gDATW,UAAU,MAAM,CAAC,iBACjB,MAAM,UACN,UAAU,MAAM,CAAC,QACjB,MAAM,SACN,MAAM,QAuChB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Newell's method: the area-weighted normal of an arbitrary 3D polygon, written
|
|
3
|
+
* to `result` at `result_offset` as a unit vector.
|
|
4
|
+
*
|
|
5
|
+
* Unlike taking the cross product of the first three vertices
|
|
6
|
+
* (what {@link bt_mesh_compute_face_normals} does, correctly, for triangles),
|
|
7
|
+
* this is defined for any vertex count, is immune to a collinear or coincident
|
|
8
|
+
* leading triple, and for a non-planar polygon returns the normal of its
|
|
9
|
+
* best-fit plane rather than of one arbitrary corner. That is exactly what
|
|
10
|
+
* projecting an n-gon down to 2D needs.
|
|
11
|
+
*
|
|
12
|
+
* A polygon with no area -- fewer than three vertices, all collinear, or all
|
|
13
|
+
* coincident -- has no normal; `result` is then written as `(0, 0, 0)`, which
|
|
14
|
+
* callers can test with a length check. That is a real outcome of real data, not
|
|
15
|
+
* an error.
|
|
16
|
+
*
|
|
17
|
+
* @param {ArrayLike<number>} result
|
|
18
|
+
* @param {number} result_offset
|
|
19
|
+
* @param {ArrayLike<number>} points flat (x, y, z) triples, stride 3
|
|
20
|
+
* @param {number} from first vertex index of the contour
|
|
21
|
+
* @param {number} count number of vertices in the contour
|
|
22
|
+
*
|
|
23
|
+
* @author Alex Goldring
|
|
24
|
+
* @copyright Company Named Limited (c) 2026
|
|
25
|
+
*/
|
|
26
|
+
export function polygon3_compute_normal(result, result_offset, points, from, count) {
|
|
27
|
+
let nx = 0;
|
|
28
|
+
let ny = 0;
|
|
29
|
+
let nz = 0;
|
|
30
|
+
|
|
31
|
+
const to = from + count;
|
|
32
|
+
|
|
33
|
+
for (let i = from; i < to; i++) {
|
|
34
|
+
const j = (i + 1 === to) ? from : i + 1;
|
|
35
|
+
|
|
36
|
+
const i3 = i * 3;
|
|
37
|
+
const j3 = j * 3;
|
|
38
|
+
|
|
39
|
+
const ax = points[i3], ay = points[i3 + 1], az = points[i3 + 2];
|
|
40
|
+
const bx = points[j3], by = points[j3 + 1], bz = points[j3 + 2];
|
|
41
|
+
|
|
42
|
+
nx += (ay - by) * (az + bz);
|
|
43
|
+
ny += (az - bz) * (ax + bx);
|
|
44
|
+
nz += (ax - bx) * (ay + by);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
48
|
+
|
|
49
|
+
if (length === 0) {
|
|
50
|
+
result[result_offset] = 0;
|
|
51
|
+
result[result_offset + 1] = 0;
|
|
52
|
+
result[result_offset + 2] = 0;
|
|
53
|
+
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
result[result_offset] = nx / length;
|
|
58
|
+
result[result_offset + 1] = ny / length;
|
|
59
|
+
result[result_offset + 2] = nz / length;
|
|
60
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triangulate a planar 3D polygon with holes, viewed along `-normal`.
|
|
3
|
+
*
|
|
4
|
+
* The polygon is projected to 2D by **dropping the axis the normal points most
|
|
5
|
+
* strongly along** and keeping the other two verbatim, swapped when that
|
|
6
|
+
* component is negative so the projection stays counter-clockwise as seen from
|
|
7
|
+
* `+normal`. Nothing is rotated and no coordinate is recomputed, which is the
|
|
8
|
+
* whole point: {@link polygon2_triangulate} decides exactly, and it can only do
|
|
9
|
+
* that on coordinates that are exactly the input's. A rotation into a fitted
|
|
10
|
+
* plane basis would round every vertex first and hand the exact predicate
|
|
11
|
+
* approximate data.
|
|
12
|
+
*
|
|
13
|
+
* `normal` need not be normalised, but it must not be zero. Derive it with
|
|
14
|
+
* {@link polygon3_compute_normal} when the caller has no authoritative one.
|
|
15
|
+
*
|
|
16
|
+
* Output indices address `points3` -- the same vertices the caller passed in --
|
|
17
|
+
* and each triangle is counter-clockwise when viewed from `+normal`.
|
|
18
|
+
*
|
|
19
|
+
* @param {Uint32Array} result receives 3 point indices per triangle
|
|
20
|
+
* @param {number} result_offset first index written in `result`
|
|
21
|
+
* @param {ArrayLike<number>} points3 flat (x, y, z) triples, stride 3
|
|
22
|
+
* @param {ArrayLike<number>} contour_ends exclusive end vertex index per contour
|
|
23
|
+
* @param {number} contour_count number of contours; contour 0 is the outer boundary
|
|
24
|
+
* @param {number} nx
|
|
25
|
+
* @param {number} ny
|
|
26
|
+
* @param {number} nz polygon normal, need not be unit length
|
|
27
|
+
* @returns {number} number of triangles written; see {@link polygon2_triangulate}
|
|
28
|
+
* for what a short count means
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export function polygon3_triangulate(result: Uint32Array, result_offset: number, points3: ArrayLike<number>, contour_ends: ArrayLike<number>, contour_count: number, nx: number, ny: number, nz: number): number;
|
|
34
|
+
//# sourceMappingURL=polygon3_triangulate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon3_triangulate.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/polygon/polygon3_triangulate.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,6CAdW,WAAW,iBACX,MAAM,WACN,UAAU,MAAM,CAAC,gBACjB,UAAU,MAAM,CAAC,iBACjB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAwDlB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
import { polygon2_triangulate } from "../../2d/polygon/polygon2_triangulate.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Projected (u, v) per vertex for the current call. Module-static and grown on
|
|
6
|
+
* demand, matching {@link polygon2_triangulate}'s own storage -- and, like it,
|
|
7
|
+
* this function is therefore not re-entrant.
|
|
8
|
+
* @type {Float64Array}
|
|
9
|
+
*/
|
|
10
|
+
let _projected = new Float64Array(0);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Triangulate a planar 3D polygon with holes, viewed along `-normal`.
|
|
14
|
+
*
|
|
15
|
+
* The polygon is projected to 2D by **dropping the axis the normal points most
|
|
16
|
+
* strongly along** and keeping the other two verbatim, swapped when that
|
|
17
|
+
* component is negative so the projection stays counter-clockwise as seen from
|
|
18
|
+
* `+normal`. Nothing is rotated and no coordinate is recomputed, which is the
|
|
19
|
+
* whole point: {@link polygon2_triangulate} decides exactly, and it can only do
|
|
20
|
+
* that on coordinates that are exactly the input's. A rotation into a fitted
|
|
21
|
+
* plane basis would round every vertex first and hand the exact predicate
|
|
22
|
+
* approximate data.
|
|
23
|
+
*
|
|
24
|
+
* `normal` need not be normalised, but it must not be zero. Derive it with
|
|
25
|
+
* {@link polygon3_compute_normal} when the caller has no authoritative one.
|
|
26
|
+
*
|
|
27
|
+
* Output indices address `points3` -- the same vertices the caller passed in --
|
|
28
|
+
* and each triangle is counter-clockwise when viewed from `+normal`.
|
|
29
|
+
*
|
|
30
|
+
* @param {Uint32Array} result receives 3 point indices per triangle
|
|
31
|
+
* @param {number} result_offset first index written in `result`
|
|
32
|
+
* @param {ArrayLike<number>} points3 flat (x, y, z) triples, stride 3
|
|
33
|
+
* @param {ArrayLike<number>} contour_ends exclusive end vertex index per contour
|
|
34
|
+
* @param {number} contour_count number of contours; contour 0 is the outer boundary
|
|
35
|
+
* @param {number} nx
|
|
36
|
+
* @param {number} ny
|
|
37
|
+
* @param {number} nz polygon normal, need not be unit length
|
|
38
|
+
* @returns {number} number of triangles written; see {@link polygon2_triangulate}
|
|
39
|
+
* for what a short count means
|
|
40
|
+
*
|
|
41
|
+
* @author Alex Goldring
|
|
42
|
+
* @copyright Company Named Limited (c) 2026
|
|
43
|
+
*/
|
|
44
|
+
export function polygon3_triangulate(
|
|
45
|
+
result, result_offset,
|
|
46
|
+
points3, contour_ends, contour_count,
|
|
47
|
+
nx, ny, nz
|
|
48
|
+
) {
|
|
49
|
+
assert.isArrayLike(points3, "points3");
|
|
50
|
+
assert.isPositiveInteger(contour_count, "contour_count");
|
|
51
|
+
assert.ok(nx !== 0 || ny !== 0 || nz !== 0, "polygon normal must not be zero");
|
|
52
|
+
|
|
53
|
+
const vertex_count = contour_ends[contour_count - 1];
|
|
54
|
+
|
|
55
|
+
if (vertex_count < 3) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (_projected.length < vertex_count * 2) {
|
|
60
|
+
_projected = new Float64Array(vertex_count * 2);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const ax = Math.abs(nx);
|
|
64
|
+
const ay = Math.abs(ny);
|
|
65
|
+
const az = Math.abs(nz);
|
|
66
|
+
|
|
67
|
+
// Component offsets of the two axes kept, in the order that preserves
|
|
68
|
+
// counter-clockwise winding seen from +normal:
|
|
69
|
+
// +x -> (y, z) -x -> (z, y)
|
|
70
|
+
// +y -> (z, x) -y -> (x, z)
|
|
71
|
+
// +z -> (x, y) -z -> (y, x)
|
|
72
|
+
let u_axis;
|
|
73
|
+
let v_axis;
|
|
74
|
+
|
|
75
|
+
if (ax >= ay && ax >= az) {
|
|
76
|
+
u_axis = nx > 0 ? 1 : 2;
|
|
77
|
+
v_axis = nx > 0 ? 2 : 1;
|
|
78
|
+
} else if (ay >= az) {
|
|
79
|
+
u_axis = ny > 0 ? 2 : 0;
|
|
80
|
+
v_axis = ny > 0 ? 0 : 2;
|
|
81
|
+
} else {
|
|
82
|
+
u_axis = nz > 0 ? 0 : 1;
|
|
83
|
+
v_axis = nz > 0 ? 1 : 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < vertex_count; i++) {
|
|
87
|
+
const i3 = i * 3;
|
|
88
|
+
|
|
89
|
+
_projected[i * 2] = points3[i3 + u_axis];
|
|
90
|
+
_projected[i * 2 + 1] = points3[i3 + v_axis];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return polygon2_triangulate(result, result_offset, _projected, contour_ends, contour_count);
|
|
94
|
+
}
|
|
@@ -14,8 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @param {number[]|Float32Array|Float64Array} out
|
|
16
16
|
* @param {number} out_offset offset into `out`; receives 4 floats (x, y, z, w)
|
|
17
|
-
* @param {number} ax
|
|
18
|
-
* @param {number}
|
|
17
|
+
* @param {number} ax
|
|
18
|
+
* @param {number} ay
|
|
19
|
+
* @param {number} az
|
|
20
|
+
* @param {number} aw
|
|
21
|
+
* @param {number} bx
|
|
22
|
+
* @param {number} by
|
|
23
|
+
* @param {number} bz
|
|
24
|
+
* @param {number} bw
|
|
19
25
|
*/
|
|
20
26
|
export function quat3_multiply(out: number[] | Float32Array | Float64Array, out_offset: number, ax: number, ay: number, az: number, aw: number, bx: number, by: number, bz: number, bw: number): void;
|
|
21
27
|
//# sourceMappingURL=quat3_multiply.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quat3_multiply.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat3_multiply.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"quat3_multiply.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat3_multiply.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oCAXW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAOhB"}
|
|
@@ -14,8 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @param {number[]|Float32Array|Float64Array} out
|
|
16
16
|
* @param {number} out_offset offset into `out`; receives 4 floats (x, y, z, w)
|
|
17
|
-
* @param {number} ax
|
|
18
|
-
* @param {number}
|
|
17
|
+
* @param {number} ax
|
|
18
|
+
* @param {number} ay
|
|
19
|
+
* @param {number} az
|
|
20
|
+
* @param {number} aw
|
|
21
|
+
* @param {number} bx
|
|
22
|
+
* @param {number} by
|
|
23
|
+
* @param {number} bz
|
|
24
|
+
* @param {number} bw
|
|
19
25
|
*/
|
|
20
26
|
export function quat3_multiply(out, out_offset, ax, ay, az, aw, bx, by, bz, bw) {
|
|
21
27
|
out[out_offset] = aw * bx + ax * bw + ay * bz - az * by;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvexHullShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/ConvexHullShape3D.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IA+CI;;;;;;;OAOG;IACH,sBAJW,YAAY,WACZ,WAAW,GACT,iBAAiB,CAQ7B;IAxDG;;;;OAIG;IACH,UAFU,YAAY,CAEa;IAEnC;;;;OAIG;IACH,SAFU,WAAW,CAEY;IAEjC;;;;;;OAMG;IACH,cAFU,WAAW,CAEiB;IACtC,0BAA0B;IAC1B,YADW,WAAW,CACc;IAEpC;;;;;;OAMG;IACH,iBAAmC;IAEnC,oCAAoC;IACpC,eAAiC;IACjC,8BAA8B;IAC9B,iBAAiB;IACjB,8BAA8B;IAC9B,uBAAuB;IAmB3B;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"ConvexHullShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/ConvexHullShape3D.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IA+CI;;;;;;;OAOG;IACH,sBAJW,YAAY,WACZ,WAAW,GACT,iBAAiB,CAQ7B;IAxDG;;;;OAIG;IACH,UAFU,YAAY,CAEa;IAEnC;;;;OAIG;IACH,SAFU,WAAW,CAEY;IAEjC;;;;;;OAMG;IACH,cAFU,WAAW,CAEiB;IACtC,0BAA0B;IAC1B,YADW,WAAW,CACc;IAEpC;;;;;;OAMG;IACH,iBAAmC;IAEnC,oCAAoC;IACpC,eAAiC;IACjC,8BAA8B;IAC9B,iBAAiB;IACjB,8BAA8B;IAC9B,uBAAuB;IAmB3B;;;OAGG;IACH,kBAiFC;IAKD,wCAIC;IAED;;;;;OAKG;IACH,qGAgBC;IAED;;;OAGG;IACH,oCAgBC;IAED;;;OAGG;IACH,6CAwBC;IAED,mEAEC;IAED,4DAwBC;IAED,kFAmBC;IAED;;;OAGG;IACH,cAHW,iBAAiB,GACf,OAAO,CAanB;IAcL;;;;OAIG;IACH,8BAFU,OAAO,CAE8B;CAP9C;gCAtV+B,sBAAsB"}
|