@woosh/meep-engine 2.164.0 → 2.165.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/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BitImage2.d.ts +91 -0
- package/src/core/binary/BitImage2.d.ts.map +1 -0
- package/src/core/binary/BitImage2.js +242 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
- package/src/core/geom/2d/packing/skyline.d.ts +116 -0
- package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
- package/src/core/geom/2d/packing/skyline.js +258 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
- package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
- package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
- package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
- package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/Chart.js +77 -0
- package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +13 -11
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
- package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
- package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
- package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cotangent.js +29 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
- package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
- package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_multiply.js +19 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve.js +106 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
- package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
- package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +3 -3
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -2
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +2 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
- package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
- package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
- package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
- package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
- package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
- package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
- package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +678 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
- package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +41 -15
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
- package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
- package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An `m x n` sparse matrix in Compressed Sparse Row form.
|
|
5
|
+
*
|
|
6
|
+
* The three parallel arrays follow the standard CSR convention:
|
|
7
|
+
* - `row_ptr[r]` = start of row r's entries in `col_idx`/`values`
|
|
8
|
+
* - `row_ptr[r+1]` = end (exclusive); `row_ptr[rows]` = nnz
|
|
9
|
+
* - `col_idx[k]` = column of entry k
|
|
10
|
+
* - `values[k]` = value of entry k
|
|
11
|
+
*
|
|
12
|
+
* Entries within a row are NOT required to be sorted by column, and duplicate
|
|
13
|
+
* (row, col) entries are permitted: matrix-vector products sum over a row, so
|
|
14
|
+
* duplicates simply accumulate — which is exactly what finite-element style
|
|
15
|
+
* assembly (many small per-element contributions to the same cell) wants. This
|
|
16
|
+
* is why {@link SparseMatrixCSR.from_triplets} performs no de-duplication pass.
|
|
17
|
+
*
|
|
18
|
+
* Fields are exposed directly (not via accessors) so hot matvec loops can run
|
|
19
|
+
* `for (let k = row_ptr[r]; k < row_ptr[r+1]; k++)` without closure overhead,
|
|
20
|
+
* mirroring {@link CSRGraph}.
|
|
21
|
+
*/
|
|
22
|
+
export class SparseMatrixCSR {
|
|
23
|
+
/**
|
|
24
|
+
* @param {number} rows
|
|
25
|
+
* @param {number} cols
|
|
26
|
+
* @param {Uint32Array} row_ptr length rows + 1
|
|
27
|
+
* @param {Uint32Array} col_idx length nnz
|
|
28
|
+
* @param {Float64Array} values length nnz
|
|
29
|
+
*/
|
|
30
|
+
constructor(rows, cols, row_ptr, col_idx, values) {
|
|
31
|
+
this.rows = rows;
|
|
32
|
+
this.cols = cols;
|
|
33
|
+
this.row_ptr = row_ptr;
|
|
34
|
+
this.col_idx = col_idx;
|
|
35
|
+
this.values = values;
|
|
36
|
+
this.nnz = values.length;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Build a CSR matrix from a triplet (coordinate) list. The triplet arrays
|
|
41
|
+
* are parallel; `count` entries are read. Duplicate (row, col) triplets are
|
|
42
|
+
* kept and will sum during matvec.
|
|
43
|
+
*
|
|
44
|
+
* @param {number} rows
|
|
45
|
+
* @param {number} cols
|
|
46
|
+
* @param {Uint32Array|number[]} triplet_rows
|
|
47
|
+
* @param {Uint32Array|number[]} triplet_cols
|
|
48
|
+
* @param {Float64Array|number[]} triplet_values
|
|
49
|
+
* @param {number} count number of triplets to read
|
|
50
|
+
* @returns {SparseMatrixCSR}
|
|
51
|
+
*/
|
|
52
|
+
static from_triplets(rows, cols, triplet_rows, triplet_cols, triplet_values, count) {
|
|
53
|
+
assert.isNonNegativeInteger(rows, "rows");
|
|
54
|
+
assert.isNonNegativeInteger(cols, "cols");
|
|
55
|
+
assert.isNonNegativeInteger(count, "count");
|
|
56
|
+
|
|
57
|
+
const row_ptr = new Uint32Array(rows + 1);
|
|
58
|
+
|
|
59
|
+
// Counting sort by row. First tally each row's entry count into the
|
|
60
|
+
// shifted slot row_ptr[r + 1].
|
|
61
|
+
for (let i = 0; i < count; i++) {
|
|
62
|
+
const r = triplet_rows[i];
|
|
63
|
+
assert.ok(r < rows, "triplet row in range");
|
|
64
|
+
row_ptr[r + 1]++;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Prefix-sum into row start offsets.
|
|
68
|
+
for (let r = 0; r < rows; r++) {
|
|
69
|
+
row_ptr[r + 1] += row_ptr[r];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const col_idx = new Uint32Array(count);
|
|
73
|
+
const values = new Float64Array(count);
|
|
74
|
+
|
|
75
|
+
// Scatter using a per-row write cursor seeded from the row starts.
|
|
76
|
+
const cursor = row_ptr.slice(0, rows);
|
|
77
|
+
for (let i = 0; i < count; i++) {
|
|
78
|
+
const r = triplet_rows[i];
|
|
79
|
+
const c = triplet_cols[i];
|
|
80
|
+
assert.ok(c < cols, "triplet col in range");
|
|
81
|
+
const dst = cursor[r]++;
|
|
82
|
+
col_idx[dst] = c;
|
|
83
|
+
values[dst] = triplet_values[i];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return new SparseMatrixCSR(rows, cols, row_ptr, col_idx, values);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparse matrix-vector product: `out = A * x`.
|
|
3
|
+
*
|
|
4
|
+
* @param {Float64Array} out length >= A.rows; overwritten
|
|
5
|
+
* @param {import("./SparseMatrixCSR.js").SparseMatrixCSR} A
|
|
6
|
+
* @param {Float64Array} x length >= A.cols
|
|
7
|
+
*/
|
|
8
|
+
export function spm_matvec(out: Float64Array, A: import("./SparseMatrixCSR.js").SparseMatrixCSR, x: Float64Array): void;
|
|
9
|
+
//# sourceMappingURL=spm_matvec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spm_matvec.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/linalg/sparse/spm_matvec.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,gCAJW,YAAY,KACZ,OAAO,sBAAsB,EAAE,eAAe,KAC9C,YAAY,QAgBtB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparse matrix-vector product: `out = A * x`.
|
|
3
|
+
*
|
|
4
|
+
* @param {Float64Array} out length >= A.rows; overwritten
|
|
5
|
+
* @param {import("./SparseMatrixCSR.js").SparseMatrixCSR} A
|
|
6
|
+
* @param {Float64Array} x length >= A.cols
|
|
7
|
+
*/
|
|
8
|
+
export function spm_matvec(out, A, x) {
|
|
9
|
+
const rows = A.rows;
|
|
10
|
+
const row_ptr = A.row_ptr;
|
|
11
|
+
const col_idx = A.col_idx;
|
|
12
|
+
const values = A.values;
|
|
13
|
+
|
|
14
|
+
for (let r = 0; r < rows; r++) {
|
|
15
|
+
const end = row_ptr[r + 1];
|
|
16
|
+
let sum = 0;
|
|
17
|
+
for (let k = row_ptr[r]; k < end; k++) {
|
|
18
|
+
sum += values[k] * x[col_idx[k]];
|
|
19
|
+
}
|
|
20
|
+
out[r] = sum;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transposed sparse matrix-vector product: `out = Aᵀ * x`.
|
|
3
|
+
*
|
|
4
|
+
* Walks A row-major and scatters each entry's contribution into the output
|
|
5
|
+
* column slot, so no explicit transpose of A is materialized.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} out length >= A.cols; overwritten
|
|
8
|
+
* @param {import("./SparseMatrixCSR.js").SparseMatrixCSR} A
|
|
9
|
+
* @param {Float64Array} x length >= A.rows
|
|
10
|
+
*/
|
|
11
|
+
export function spm_matvec_transpose(out: Float64Array, A: import("./SparseMatrixCSR.js").SparseMatrixCSR, x: Float64Array): void;
|
|
12
|
+
//# sourceMappingURL=spm_matvec_transpose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spm_matvec_transpose.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/linalg/sparse/spm_matvec_transpose.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,0CAJW,YAAY,KACZ,OAAO,sBAAsB,EAAE,eAAe,KAC9C,YAAY,QAoBtB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transposed sparse matrix-vector product: `out = Aᵀ * x`.
|
|
3
|
+
*
|
|
4
|
+
* Walks A row-major and scatters each entry's contribution into the output
|
|
5
|
+
* column slot, so no explicit transpose of A is materialized.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} out length >= A.cols; overwritten
|
|
8
|
+
* @param {import("./SparseMatrixCSR.js").SparseMatrixCSR} A
|
|
9
|
+
* @param {Float64Array} x length >= A.rows
|
|
10
|
+
*/
|
|
11
|
+
export function spm_matvec_transpose(out, A, x) {
|
|
12
|
+
const rows = A.rows;
|
|
13
|
+
const cols = A.cols;
|
|
14
|
+
const row_ptr = A.row_ptr;
|
|
15
|
+
const col_idx = A.col_idx;
|
|
16
|
+
const values = A.values;
|
|
17
|
+
|
|
18
|
+
for (let c = 0; c < cols; c++) {
|
|
19
|
+
out[c] = 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for (let r = 0; r < rows; r++) {
|
|
23
|
+
const xr = x[r];
|
|
24
|
+
const end = row_ptr[r + 1];
|
|
25
|
+
for (let k = row_ptr[r]; k < end; k++) {
|
|
26
|
+
out[col_idx[k]] += values[k] * xr;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -4,6 +4,7 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
4
4
|
let cross_section_scattering: number[];
|
|
5
5
|
let cross_section_extinction: number[];
|
|
6
6
|
let g: number;
|
|
7
|
+
let albedo: number[];
|
|
7
8
|
}
|
|
8
9
|
namespace CONTINENTAL_HAZE_MEDIUM {
|
|
9
10
|
let radius_1: number;
|
|
@@ -14,6 +15,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
14
15
|
export { cross_section_extinction_1 as cross_section_extinction };
|
|
15
16
|
let g_1: number;
|
|
16
17
|
export { g_1 as g };
|
|
18
|
+
let albedo_1: number[];
|
|
19
|
+
export { albedo_1 as albedo };
|
|
17
20
|
}
|
|
18
21
|
namespace CONTINENTAL_HAZE_LARGE {
|
|
19
22
|
let radius_2: number;
|
|
@@ -24,6 +27,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
24
27
|
export { cross_section_extinction_2 as cross_section_extinction };
|
|
25
28
|
let g_2: number;
|
|
26
29
|
export { g_2 as g };
|
|
30
|
+
let albedo_2: number[];
|
|
31
|
+
export { albedo_2 as albedo };
|
|
27
32
|
}
|
|
28
33
|
namespace MARITIME_HAZE_SMALL {
|
|
29
34
|
let radius_3: number;
|
|
@@ -34,6 +39,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
34
39
|
export { cross_section_extinction_3 as cross_section_extinction };
|
|
35
40
|
let g_3: number;
|
|
36
41
|
export { g_3 as g };
|
|
42
|
+
let albedo_3: number[];
|
|
43
|
+
export { albedo_3 as albedo };
|
|
37
44
|
}
|
|
38
45
|
namespace MARITIME_HAZE_MEDIUM {
|
|
39
46
|
let radius_4: number;
|
|
@@ -44,6 +51,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
44
51
|
export { cross_section_extinction_4 as cross_section_extinction };
|
|
45
52
|
let g_4: number;
|
|
46
53
|
export { g_4 as g };
|
|
54
|
+
let albedo_4: number[];
|
|
55
|
+
export { albedo_4 as albedo };
|
|
47
56
|
}
|
|
48
57
|
namespace MARITIME_HAZE_LARGE {
|
|
49
58
|
let radius_5: number;
|
|
@@ -54,6 +63,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
54
63
|
export { cross_section_extinction_5 as cross_section_extinction };
|
|
55
64
|
let g_5: number;
|
|
56
65
|
export { g_5 as g };
|
|
66
|
+
let albedo_5: number[];
|
|
67
|
+
export { albedo_5 as albedo };
|
|
57
68
|
}
|
|
58
69
|
namespace FOG_DROPLET_SMALL {
|
|
59
70
|
let radius_6: number;
|
|
@@ -64,6 +75,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
64
75
|
export { cross_section_extinction_6 as cross_section_extinction };
|
|
65
76
|
let g_6: number;
|
|
66
77
|
export { g_6 as g };
|
|
78
|
+
let albedo_6: number[];
|
|
79
|
+
export { albedo_6 as albedo };
|
|
67
80
|
}
|
|
68
81
|
namespace FOG_DROPLET_MEDIUM {
|
|
69
82
|
let radius_7: number;
|
|
@@ -74,6 +87,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
74
87
|
export { cross_section_extinction_7 as cross_section_extinction };
|
|
75
88
|
let g_7: number;
|
|
76
89
|
export { g_7 as g };
|
|
90
|
+
let albedo_7: number[];
|
|
91
|
+
export { albedo_7 as albedo };
|
|
77
92
|
}
|
|
78
93
|
namespace CLOUD_DROPLET_LARGE {
|
|
79
94
|
let radius_8: number;
|
|
@@ -84,6 +99,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
84
99
|
export { cross_section_extinction_8 as cross_section_extinction };
|
|
85
100
|
let g_8: number;
|
|
86
101
|
export { g_8 as g };
|
|
102
|
+
let albedo_8: number[];
|
|
103
|
+
export { albedo_8 as albedo };
|
|
87
104
|
}
|
|
88
105
|
namespace SMOKE_PARTICLE_SMALL {
|
|
89
106
|
let radius_9: number;
|
|
@@ -94,6 +111,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
94
111
|
export { cross_section_extinction_9 as cross_section_extinction };
|
|
95
112
|
let g_9: number;
|
|
96
113
|
export { g_9 as g };
|
|
114
|
+
let albedo_9: number[];
|
|
115
|
+
export { albedo_9 as albedo };
|
|
97
116
|
}
|
|
98
117
|
namespace SMOKE_PARTICLE_MEDIUM {
|
|
99
118
|
let radius_10: number;
|
|
@@ -104,6 +123,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
104
123
|
export { cross_section_extinction_10 as cross_section_extinction };
|
|
105
124
|
let g_10: number;
|
|
106
125
|
export { g_10 as g };
|
|
126
|
+
let albedo_10: number[];
|
|
127
|
+
export { albedo_10 as albedo };
|
|
107
128
|
}
|
|
108
129
|
namespace SMOKE_PARTICLE_LARGE {
|
|
109
130
|
let radius_11: number;
|
|
@@ -114,6 +135,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
114
135
|
export { cross_section_extinction_11 as cross_section_extinction };
|
|
115
136
|
let g_11: number;
|
|
116
137
|
export { g_11 as g };
|
|
138
|
+
let albedo_11: number[];
|
|
139
|
+
export { albedo_11 as albedo };
|
|
117
140
|
}
|
|
118
141
|
namespace SOOT_PARTICLE_SMALL {
|
|
119
142
|
let radius_12: number;
|
|
@@ -124,6 +147,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
124
147
|
export { cross_section_extinction_12 as cross_section_extinction };
|
|
125
148
|
let g_12: number;
|
|
126
149
|
export { g_12 as g };
|
|
150
|
+
let albedo_12: number[];
|
|
151
|
+
export { albedo_12 as albedo };
|
|
127
152
|
}
|
|
128
153
|
namespace SOOT_AGGREGATE_MEDIUM {
|
|
129
154
|
let radius_13: number;
|
|
@@ -134,6 +159,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
134
159
|
export { cross_section_extinction_13 as cross_section_extinction };
|
|
135
160
|
let g_13: number;
|
|
136
161
|
export { g_13 as g };
|
|
162
|
+
let albedo_13: number[];
|
|
163
|
+
export { albedo_13 as albedo };
|
|
137
164
|
}
|
|
138
165
|
namespace SOOT_AGGREGATE_LARGE {
|
|
139
166
|
let radius_14: number;
|
|
@@ -144,6 +171,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
144
171
|
export { cross_section_extinction_14 as cross_section_extinction };
|
|
145
172
|
let g_14: number;
|
|
146
173
|
export { g_14 as g };
|
|
174
|
+
let albedo_14: number[];
|
|
175
|
+
export { albedo_14 as albedo };
|
|
147
176
|
}
|
|
148
177
|
namespace FINE_DUST_SMALL {
|
|
149
178
|
let radius_15: number;
|
|
@@ -154,6 +183,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
154
183
|
export { cross_section_extinction_15 as cross_section_extinction };
|
|
155
184
|
let g_15: number;
|
|
156
185
|
export { g_15 as g };
|
|
186
|
+
let albedo_15: number[];
|
|
187
|
+
export { albedo_15 as albedo };
|
|
157
188
|
}
|
|
158
189
|
namespace COARSE_DUST_MEDIUM {
|
|
159
190
|
let radius_16: number;
|
|
@@ -164,6 +195,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
164
195
|
export { cross_section_extinction_16 as cross_section_extinction };
|
|
165
196
|
let g_16: number;
|
|
166
197
|
export { g_16 as g };
|
|
198
|
+
let albedo_16: number[];
|
|
199
|
+
export { albedo_16 as albedo };
|
|
167
200
|
}
|
|
168
201
|
namespace COARSE_DUST_LARGE {
|
|
169
202
|
let radius_17: number;
|
|
@@ -174,6 +207,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
174
207
|
export { cross_section_extinction_17 as cross_section_extinction };
|
|
175
208
|
let g_17: number;
|
|
176
209
|
export { g_17 as g };
|
|
210
|
+
let albedo_17: number[];
|
|
211
|
+
export { albedo_17 as albedo };
|
|
177
212
|
}
|
|
178
213
|
namespace POLLEN_PARTICLE_MEDIUM {
|
|
179
214
|
let radius_18: number;
|
|
@@ -184,6 +219,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
184
219
|
export { cross_section_extinction_18 as cross_section_extinction };
|
|
185
220
|
let g_18: number;
|
|
186
221
|
export { g_18 as g };
|
|
222
|
+
let albedo_18: number[];
|
|
223
|
+
export { albedo_18 as albedo };
|
|
187
224
|
}
|
|
188
225
|
namespace POLLEN_PARTICLE_LARGE {
|
|
189
226
|
let radius_19: number;
|
|
@@ -194,6 +231,8 @@ export namespace MIE_PARTICLES_STANDARD_PRECOMPUTED {
|
|
|
194
231
|
export { cross_section_extinction_19 as cross_section_extinction };
|
|
195
232
|
let g_19: number;
|
|
196
233
|
export { g_19 as g };
|
|
234
|
+
let albedo_19: number[];
|
|
235
|
+
export { albedo_19 as albedo };
|
|
197
236
|
}
|
|
198
237
|
}
|
|
199
238
|
//# sourceMappingURL=MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts.map
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* 📚 Precomputed standard atmospheric particle library for rendering.
|
|
3
3
|
*
|
|
4
4
|
* This file is GENERATED. Do not edit by hand.
|
|
5
|
-
* Generation settings: 380–780 nm,
|
|
5
|
+
* Generation settings: 380–780 nm, step_size=5 nm (81 samples), sRGB CMFs, medium=air.
|
|
6
6
|
*
|
|
7
7
|
* Each entry contains:
|
|
8
8
|
* - radius: Particle radius in meters.
|
|
9
9
|
* - cross_section_scattering: [R, G, B] scattering coefficients (m²).
|
|
10
10
|
* - cross_section_extinction: [R, G, B] extinction coefficients (m²).
|
|
11
11
|
* - g: Asymmetry parameter (average cosine of the scattering angle).
|
|
12
|
+
* - albedo: [R, G, B] single-scattering albedo — the scattered fraction of extinguished light, in [0,1].
|
|
12
13
|
*/
|
|
13
14
|
export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
14
15
|
|
|
@@ -24,6 +25,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
24
25
|
cross_section_scattering: [1.0372407599145680e-16, 2.1697944076390811e-16, 4.9834805745060257e-16],
|
|
25
26
|
cross_section_extinction: [1.0390516205855430e-16, 2.1717567420831002e-16, 4.9879159253139388e-16],
|
|
26
27
|
g: 0.06687111747972882,
|
|
28
|
+
albedo: [0.9985408461697118, 0.9990945681117027, 0.9988629217749472],
|
|
27
29
|
},
|
|
28
30
|
/**
|
|
29
31
|
* MEDIUM — typical daytime urban/valley haze with gentle desaturation.
|
|
@@ -34,6 +36,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
34
36
|
cross_section_scattering: [5.4565579877961842e-13, 6.8621977746322113e-13, 8.2869951608010304e-13],
|
|
35
37
|
cross_section_extinction: [5.4570905150853122e-13, 6.8627271753511908e-13, 8.2881953884176050e-13],
|
|
36
38
|
g: 0.72195208606467531,
|
|
39
|
+
albedo: [0.9999482576027167, 0.9999364568774085, 0.9995816510680566],
|
|
37
40
|
},
|
|
38
41
|
/**
|
|
39
42
|
* LARGE — thicker land haze; think post‑inversion murk softening hills.
|
|
@@ -44,6 +47,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
44
47
|
cross_section_scattering: [3.0366185612989802e-12, 2.1644690526988712e-12, 1.3935109366522711e-12],
|
|
45
48
|
cross_section_extinction: [3.0370652035911430e-12, 2.1649491115406566e-12, 1.3945337813123169e-12],
|
|
46
49
|
g: 0.6137288243405209,
|
|
50
|
+
albedo: [0.9998952697384723, 0.9998037766123345, 0.9990189659047288],
|
|
47
51
|
},
|
|
48
52
|
|
|
49
53
|
/**
|
|
@@ -56,6 +60,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
56
60
|
cross_section_scattering: [5.5914464124496594e-17, 1.1568131266404890e-16, 2.6209632958954776e-16],
|
|
57
61
|
cross_section_extinction: [5.5915758040155253e-17, 1.1568241782228503e-16, 2.6209808791233174e-16],
|
|
58
62
|
g: 0.062667411576877274,
|
|
63
|
+
albedo: [1, 1, 0.9997202441579425],
|
|
59
64
|
},
|
|
60
65
|
/**
|
|
61
66
|
* MEDIUM — bright, milky air on a breezy beach or around harbors.
|
|
@@ -66,6 +71,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
66
71
|
cross_section_scattering: [2.7132966283888992e-13, 4.0042270998895428e-13, 5.5420120025016184e-13],
|
|
67
72
|
cross_section_extinction: [2.7132992896636519e-13, 4.0042294960829909e-13, 5.5420156922320274e-13],
|
|
68
73
|
g: 0.75572608442123446,
|
|
74
|
+
albedo: [1, 1, 0.9997260009141733],
|
|
69
75
|
},
|
|
70
76
|
/**
|
|
71
77
|
* LARGE — thick marine layer look before it becomes fog.
|
|
@@ -76,6 +82,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
76
82
|
cross_section_scattering: [3.0886970942611371e-12, 3.1506283070098210e-12, 2.6753836337037947e-12],
|
|
77
83
|
cross_section_extinction: [3.0886995489983882e-12, 3.1506303784552175e-12, 2.6753868296970645e-12],
|
|
78
84
|
g: 0.82009537287886958,
|
|
85
|
+
albedo: [1, 1, 0.9997254620813307],
|
|
79
86
|
},
|
|
80
87
|
|
|
81
88
|
/**
|
|
@@ -88,6 +95,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
88
95
|
cross_section_scattering: [6.6872146821004324e-12, 5.4309369486615811e-12, 7.5571588161013023e-12],
|
|
89
96
|
cross_section_extinction: [6.6872171928267207e-12, 5.4309373592604994e-12, 7.5571591319672130e-12],
|
|
90
97
|
g: 0.66286908969703728,
|
|
98
|
+
albedo: [1, 1, 0.9997266227065711],
|
|
91
99
|
},
|
|
92
100
|
/**
|
|
93
101
|
* MEDIUM — typical road fog reducing visibility to a few hundred meters.
|
|
@@ -98,6 +106,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
98
106
|
cross_section_scattering: [1.7036472789376784e-10, 1.6665060947239930e-10, 1.6466175909414485e-10],
|
|
99
107
|
cross_section_extinction: [1.7036520771027743e-10, 1.6665065143578210e-10, 1.6466177643977473e-10],
|
|
100
108
|
g: 0.85263072331984047,
|
|
109
|
+
albedo: [1, 1, 0.9997265540670952],
|
|
101
110
|
},
|
|
102
111
|
/**
|
|
103
112
|
* LARGE — bright, thick cloud core or dense sea fog.
|
|
@@ -108,6 +117,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
108
117
|
cross_section_scattering: [6.5315742448115536e-10, 6.5618165104565060e-10, 6.5250478893917499e-10],
|
|
109
118
|
cross_section_extinction: [6.5315858886811270e-10, 6.5618181350359152e-10, 6.5250489005400894e-10],
|
|
110
119
|
g: 0.86080713114012297,
|
|
120
|
+
albedo: [1, 1, 0.9997265064666194],
|
|
111
121
|
},
|
|
112
122
|
|
|
113
123
|
|
|
@@ -123,6 +133,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
123
133
|
cross_section_scattering: [2.5095238381331490e-13, 3.2817527241713552e-13, 4.7184181688431561e-13],
|
|
124
134
|
cross_section_extinction: [2.5244957121744367e-13, 3.3073489397071378e-13, 4.7766204956433065e-13],
|
|
125
135
|
g: 0.64153537730937171,
|
|
136
|
+
albedo: [0.9940376689636649, 0.9921581959561507, 0.9874287159432464],
|
|
126
137
|
},
|
|
127
138
|
/**
|
|
128
139
|
* MEDIUM — typical wildfire/chimney smoke drifting across a valley.
|
|
@@ -133,6 +144,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
133
144
|
cross_section_scattering: [2.2186086454447846e-12, 1.8611290477348588e-12, 1.2017961650839806e-12],
|
|
134
145
|
cross_section_extinction: [2.2347400788139265e-12, 1.8849701372888018e-12, 1.2529531542589939e-12],
|
|
135
146
|
g: 0.68088789083915369,
|
|
147
|
+
albedo: [0.9925135411273615, 0.9880783700292635, 0.9592909905007622],
|
|
136
148
|
},
|
|
137
149
|
/**
|
|
138
150
|
* LARGE — aged regional smoke layers that turn the sun orange.
|
|
@@ -143,6 +155,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
143
155
|
cross_section_scattering: [9.7154096631596466e-12, 6.5695017319655712e-12, 6.5950874641241054e-12],
|
|
144
156
|
cross_section_extinction: [9.9744536671262377e-12, 6.9383549994562171e-12, 7.2416530016257137e-12],
|
|
145
157
|
g: 0.73891619526845487,
|
|
158
|
+
albedo: [0.9782832572395267, 0.9461858372785726, 0.9117468524231586],
|
|
146
159
|
},
|
|
147
160
|
|
|
148
161
|
/**
|
|
@@ -155,6 +168,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
155
168
|
cross_section_scattering: [4.9471331742851396e-18, 1.1425655543629920e-17, 3.3950349242847612e-17],
|
|
156
169
|
cross_section_extinction: [4.9469989827650098e-16, 6.4148352307268963e-16, 9.4380272697116261e-16],
|
|
157
170
|
g: 0.018039326863221513,
|
|
171
|
+
albedo: [0.010285326290695309, 0.01831185679777372, 0.03622476700049886],
|
|
158
172
|
},
|
|
159
173
|
/**
|
|
160
174
|
* MEDIUM — traffic/industrial pollution haze mixing into city air.
|
|
@@ -165,6 +179,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
165
179
|
cross_section_scattering: [1.6352855504532771e-14, 2.6526196915106281e-14, 3.7046081158626368e-14],
|
|
166
180
|
cross_section_extinction: [5.6514531230912217e-14, 7.3826992547192368e-14, 8.8338524712659901e-14],
|
|
167
181
|
g: 0.31674236124633798,
|
|
182
|
+
albedo: [0.29546957226435, 0.3595390060739381, 0.4207032773370711],
|
|
168
183
|
},
|
|
169
184
|
/**
|
|
170
185
|
* LARGE — heavy dirty smoke near source: burning oil/tires.
|
|
@@ -175,6 +190,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
175
190
|
cross_section_scattering: [1.6063607357301153e-13, 1.6542541029497725e-13, 1.6709682614452953e-13],
|
|
176
191
|
cross_section_extinction: [3.6165255982805808e-13, 3.6212311121035904e-13, 3.5517926834511851e-13],
|
|
177
192
|
g: 0.69133198032115784,
|
|
193
|
+
albedo: [0.4441637960717832, 0.45681906031998054, 0.47032807048131975],
|
|
178
194
|
},
|
|
179
195
|
|
|
180
196
|
|
|
@@ -190,6 +206,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
190
206
|
cross_section_scattering: [2.6570379687422880e-12, 3.6996919661206611e-12, 4.5471939176491137e-12],
|
|
191
207
|
cross_section_extinction: [2.8819492220384537e-12, 4.1008076519912007e-12, 5.1659038204372376e-12],
|
|
192
208
|
g: 0.63886827482281139,
|
|
209
|
+
albedo: [0.9197730722024005, 0.9020084626161894, 0.8791962654314995],
|
|
193
210
|
},
|
|
194
211
|
/**
|
|
195
212
|
* MEDIUM — moving dust clouds from vehicles or field winds.
|
|
@@ -200,6 +217,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
200
217
|
cross_section_scattering: [3.5472196264524937e-11, 3.3430210987054714e-11, 3.2075451113920786e-11],
|
|
201
218
|
cross_section_extinction: [4.2441528450403185e-11, 4.3597399152097500e-11, 4.3350184971955535e-11],
|
|
202
219
|
g: 0.84075100028702532,
|
|
220
|
+
albedo: [0.8355771860125581, 0.7660764258472097, 0.7394172548514861],
|
|
203
221
|
},
|
|
204
222
|
/**
|
|
205
223
|
* LARGE — sandstorm wall: near‑camera blowing sand/tan curtains.
|
|
@@ -210,6 +228,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
210
228
|
cross_section_scattering: [3.1816278385853973e-10, 2.9406557017587955e-10, 2.6643041098315311e-10],
|
|
211
229
|
cross_section_extinction: [3.7355130308305938e-10, 3.7144494812949936e-10, 3.6814067045857220e-10],
|
|
212
230
|
g: 0.85247658559411998,
|
|
231
|
+
albedo: [0.851940172384625, 0.7916224939997588, 0.72361818240274],
|
|
213
232
|
},
|
|
214
233
|
|
|
215
234
|
/**
|
|
@@ -222,6 +241,7 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
222
241
|
cross_section_scattering: [6.3652345959538284e-10, 6.2647624730458445e-10, 5.8718713214140584e-10],
|
|
223
242
|
cross_section_extinction: [6.5918545142090177e-10, 6.5700023143709686e-10, 6.5127465699910976e-10],
|
|
224
243
|
g: 0.81082270359712194,
|
|
244
|
+
albedo: [0.965664875936545, 0.9535618270156249, 0.9013536004003102],
|
|
225
245
|
},
|
|
226
246
|
/**
|
|
227
247
|
* LARGE — visible puffs from trees (e.g., pine) or catkins in forests.
|
|
@@ -232,5 +252,6 @@ export const MIE_PARTICLES_STANDARD_PRECOMPUTED = {
|
|
|
232
252
|
cross_section_scattering: [1.3961132818036018e-9, 1.3739693858138355e-9, 1.2750015299393954e-9],
|
|
233
253
|
cross_section_extinction: [1.4562652589727905e-9, 1.4596101004954230e-9, 1.4523332353409636e-9],
|
|
234
254
|
g: 0.81884345812519288,
|
|
255
|
+
albedo: [0.9586761245647418, 0.9413733861856849, 0.8776540420546609],
|
|
235
256
|
},
|
|
236
257
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_mie_particle_properties_rgb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_particle_properties_rgb.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,8DALW,MAAM,uCAGN,MAAM;;;;;;
|
|
1
|
+
{"version":3,"file":"compute_mie_particle_properties_rgb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_particle_properties_rgb.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,8DALW,MAAM,uCAGN,MAAM;;;;;;EA+JhB"}
|
|
@@ -24,7 +24,8 @@ export function compute_mie_particle_properties_rgb(
|
|
|
24
24
|
assert.greaterThan(radius_m, 0, 'radius_m must be positive');
|
|
25
25
|
assert.isFunction(n_p, 'n_p');
|
|
26
26
|
assert.isFunction(n_med, 'n_med');
|
|
27
|
-
|
|
27
|
+
// must be > 0: a zero step never advances the sweep loop (infinite loop).
|
|
28
|
+
assert.isPositiveInteger(step_size_nm, 'step_size_nm');
|
|
28
29
|
|
|
29
30
|
const cmf = [0, 0, 0];
|
|
30
31
|
let sum_Ey = 0;
|
|
@@ -33,6 +34,17 @@ export function compute_mie_particle_properties_rgb(
|
|
|
33
34
|
const extinction_coefficients = [0, 0, 0];
|
|
34
35
|
const sigma_a_med = [0, 0, 0];
|
|
35
36
|
|
|
37
|
+
// Single-scattering albedo ϖ(λ) = C_sca/C_ext is a per-wavelength quantity in [0, 1]. We
|
|
38
|
+
// accumulate it as its own tristimulus colour and resolve it BEFORE the XYZ→sRGB transform.
|
|
39
|
+
// Deriving albedo the other way — dividing the two finished sRGB coefficient triples — is wrong:
|
|
40
|
+
// the sRGB matrix has large negative off-diagonals, so the per-wavelength ordering C_sca ≤ C_ext
|
|
41
|
+
// (which holds component-wise in XYZ, where the CMF weights are non-negative) is destroyed
|
|
42
|
+
// channel-wise. That yields unphysical albedo — escaping the [min,max] spectral envelope, and for
|
|
43
|
+
// chromatic absorbers pinning to 0 (a scattering channel reported as a perfect absorber) or
|
|
44
|
+
// masking to 1 (an absorbing channel reported as non-absorbing). Integrating ϖ(λ) directly keeps
|
|
45
|
+
// it a true positive-weighted spectral mean.
|
|
46
|
+
const albedo_xyz = [0, 0, 0];
|
|
47
|
+
|
|
36
48
|
const ir_particle = [];
|
|
37
49
|
const ir_medium = [];
|
|
38
50
|
|
|
@@ -84,6 +96,12 @@ export function compute_mie_particle_properties_rgb(
|
|
|
84
96
|
sigma_a_med[1] += properties.sigma_a_med * wY;
|
|
85
97
|
sigma_a_med[2] += properties.sigma_a_med * wZ;
|
|
86
98
|
|
|
99
|
+
// integrate the per-wavelength single-scattering albedo as its own colour (see albedo_xyz note)
|
|
100
|
+
const single_scatter_albedo = properties.C_ext > 0 ? properties.C_sca / properties.C_ext : 0;
|
|
101
|
+
albedo_xyz[0] += single_scatter_albedo * wX;
|
|
102
|
+
albedo_xyz[1] += single_scatter_albedo * wY;
|
|
103
|
+
albedo_xyz[2] += single_scatter_albedo * wZ;
|
|
104
|
+
|
|
87
105
|
// We weight 'g' by how much this wavelength contributes to
|
|
88
106
|
// the Visible Luminance (Y) of the Scattered light.
|
|
89
107
|
// If C_sca is 0, this wavelength should not affect the average G.
|
|
@@ -108,6 +126,10 @@ export function compute_mie_particle_properties_rgb(
|
|
|
108
126
|
sigma_a_med[1] *= k;
|
|
109
127
|
sigma_a_med[2] *= k;
|
|
110
128
|
|
|
129
|
+
albedo_xyz[0] *= k;
|
|
130
|
+
albedo_xyz[1] *= k;
|
|
131
|
+
albedo_xyz[2] *= k;
|
|
132
|
+
|
|
111
133
|
// Resolve G
|
|
112
134
|
// If the particle is invisible (no scattering), default to isotropic (0)
|
|
113
135
|
const final_g = g_weight_total > 1e-20 ? (g_weighted_accumulator / g_weight_total) : 0;
|
|
@@ -118,6 +140,15 @@ export function compute_mie_particle_properties_rgb(
|
|
|
118
140
|
xyz_to_rgb(extinction_coefficients, extinction_coefficients);
|
|
119
141
|
xyz_to_rgb(sigma_a_med, sigma_a_med);
|
|
120
142
|
|
|
143
|
+
// Resolve the single-scattering albedo colour from its own integral. ϖ(λ)∈[0,1] is
|
|
144
|
+
// reflectance-like, so a saturated albedo spectrum can land marginally outside the sRGB gamut;
|
|
145
|
+
// clamp each channel back into [0,1].
|
|
146
|
+
const albedo = [0, 0, 0];
|
|
147
|
+
xyz_to_rgb(albedo, albedo_xyz);
|
|
148
|
+
albedo[0] = Math.min(1, Math.max(0, albedo[0]));
|
|
149
|
+
albedo[1] = Math.min(1, Math.max(0, albedo[1]));
|
|
150
|
+
albedo[2] = Math.min(1, Math.max(0, albedo[2]));
|
|
151
|
+
|
|
121
152
|
// Perform gamut clamp to remove potential negative lobes
|
|
122
153
|
scattering_coefficients[0] = Math.max(0, scattering_coefficients[0]);
|
|
123
154
|
scattering_coefficients[1] = Math.max(0, scattering_coefficients[1]);
|
|
@@ -131,14 +162,6 @@ export function compute_mie_particle_properties_rgb(
|
|
|
131
162
|
sigma_a_med[1] = Math.max(0, sigma_a_med[1]);
|
|
132
163
|
sigma_a_med[2] = Math.max(0, sigma_a_med[2]);
|
|
133
164
|
|
|
134
|
-
// Derive the albedo.
|
|
135
|
-
// Prevent division by 0, and clamp gamut at the upper range to 1
|
|
136
|
-
const albedo = [
|
|
137
|
-
extinction_coefficients[0] !== 0 ? Math.min(1, scattering_coefficients[0] / extinction_coefficients[0]) : 0,
|
|
138
|
-
extinction_coefficients[1] !== 0 ? Math.min(1, scattering_coefficients[1] / extinction_coefficients[1]) : 0,
|
|
139
|
-
extinction_coefficients[2] !== 0 ? Math.min(1, scattering_coefficients[2] / extinction_coefficients[2]) : 0,
|
|
140
|
-
];
|
|
141
|
-
|
|
142
165
|
return {
|
|
143
166
|
scattering_coefficients,
|
|
144
167
|
extinction_coefficients,
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
* @param {Float32Array} ab - The flat array of a_n, b_n coefficients from LorenzMie_coefs.
|
|
8
8
|
* @param {number} C_sca total scattering cross-section for normalization
|
|
9
9
|
* @param {number} wavelength - Wavelength of light in vacuum (in meters).
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {number[]|Float32Array|Float64Array} n_med - Complex refractive index of the medium.
|
|
11
11
|
* @param {number} cos_theta - Cosine of the angle between incoming light and observation angle.
|
|
12
12
|
* @returns {number} The normalized phase function value P(theta).
|
|
13
13
|
*/
|
|
14
|
-
export function compute_mie_phase(ab: Float32Array, C_sca: number, n_med:
|
|
15
|
-
import { vec2 } from "./lorenz_mie_coefs.js";
|
|
14
|
+
export function compute_mie_phase(ab: Float32Array, C_sca: number, n_med: number[] | Float32Array | Float64Array, wavelength: number, cos_theta: number): number;
|
|
16
15
|
//# sourceMappingURL=compute_mie_phase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_mie_phase.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_phase.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compute_mie_phase.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_phase.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,sCAPW,YAAY,SACZ,MAAM,SAEN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cADlC,MAAM,aAEN,MAAM,GACJ,MAAM,CAsElB"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { vec2 } from "./lorenz_mie_coefs.js";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Computes the normalized Mie phase function value for a specific angle.
|
|
5
3
|
*
|
|
@@ -9,7 +7,7 @@ import { vec2 } from "./lorenz_mie_coefs.js";
|
|
|
9
7
|
* @param {Float32Array} ab - The flat array of a_n, b_n coefficients from LorenzMie_coefs.
|
|
10
8
|
* @param {number} C_sca total scattering cross-section for normalization
|
|
11
9
|
* @param {number} wavelength - Wavelength of light in vacuum (in meters).
|
|
12
|
-
* @param {
|
|
10
|
+
* @param {number[]|Float32Array|Float64Array} n_med - Complex refractive index of the medium.
|
|
13
11
|
* @param {number} cos_theta - Cosine of the angle between incoming light and observation angle.
|
|
14
12
|
* @returns {number} The normalized phase function value P(theta).
|
|
15
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lorenz_mie_coefs.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/lorenz_mie_coefs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lorenz_mie_coefs.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/lorenz_mie_coefs.js"],"names":[],"mappings":"AAqIA;;;;;;;;;;;;;GAaG;AACH,+CATW,MAAM,YADN,MAAM,OAEN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,SAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,GAChC,YAAY,CAoGxB"}
|
|
@@ -5,13 +5,6 @@ import { complex_div } from "../../complex/complex_div.js";
|
|
|
5
5
|
import { complex_mul } from "../../complex/complex_mul.js";
|
|
6
6
|
import { complex_sub } from "../../complex/complex_sub.js";
|
|
7
7
|
|
|
8
|
-
// Kept for compute_mie_phase.js. The complex algebra below is allocation-free (it calls the meep
|
|
9
|
-
// complex primitives directly into reused scratch), so the old allocating cadd/cmult/cdiv wrappers
|
|
10
|
-
// are gone.
|
|
11
|
-
export function vec2(x, y) {
|
|
12
|
-
return new Float64Array([x, y]);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
// ---------------------------------------------------------------------------------------------
|
|
16
9
|
// Allocation-free complex algebra.
|
|
17
10
|
//
|