@woosh/meep-engine 2.107.0 → 2.108.2
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-image-decoder.js +1 -1
- package/build/meep.cjs +255 -172
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +255 -173
- package/editor/tools/paint/TerrainHeightPaintTool.js +5 -5
- package/package.json +1 -1
- package/src/core/binary/float_to_uint8.d.ts +7 -0
- package/src/core/binary/float_to_uint8.d.ts.map +1 -0
- package/src/core/binary/{float2uint8.js → float_to_uint8.js} +1 -1
- package/src/core/binary/int32_to_binary_string.d.ts +3 -2
- package/src/core/binary/int32_to_binary_string.d.ts.map +1 -1
- package/src/core/binary/int32_to_binary_string.js +18 -14
- package/src/core/binary/split_by_3.spec.d.ts +2 -0
- package/src/core/binary/split_by_3.spec.d.ts.map +1 -0
- package/src/core/binary/split_by_3.spec.js +22 -0
- package/src/core/binary/to_half_float_uint16.d.ts.map +1 -1
- package/src/core/binary/to_half_float_uint16.js +7 -5
- package/src/core/binary/uint8_to_float.d.ts +7 -0
- package/src/core/binary/uint8_to_float.d.ts.map +1 -0
- package/src/core/binary/{uint82float.js → uint8_to_float.js} +1 -1
- package/src/core/binary/uint8_to_float.spec.d.ts +2 -0
- package/src/core/binary/uint8_to_float.spec.d.ts.map +1 -0
- package/src/core/binary/uint8_to_float.spec.js +7 -0
- package/src/core/codegen/codeToBlob.d.ts +8 -0
- package/src/core/codegen/codeToBlob.d.ts.map +1 -0
- package/src/core/codegen/codeToBlob.js +36 -0
- package/src/core/codegen/codeToURL.d.ts +8 -0
- package/src/core/codegen/codeToURL.d.ts.map +1 -0
- package/src/core/codegen/codeToURL.js +22 -0
- package/src/core/collection/array/array_shuffle.d.ts +8 -0
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -0
- package/src/core/collection/array/array_shuffle.js +22 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts +2 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts.map +1 -0
- package/src/core/collection/array/{randomizeArrayElementOrder.spec.js → array_shuffle.spec.js} +4 -4
- package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorRandom.js +2 -2
- package/src/core/collection/array/randomMultipleFromArray.js +2 -2
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +16 -11
- package/src/core/color/hsv/hsv2rgb.js +4 -4
- package/src/core/color/hsv/rgb2hsv.d.ts +3 -3
- package/src/core/color/hsv/rgb2hsv.d.ts.map +1 -1
- package/src/core/color/hsv/rgb2hsv.js +11 -18
- package/src/core/color/rgb2uint24.js +4 -4
- package/src/core/color/rgb_to_luminance.d.ts +9 -0
- package/src/core/color/rgb_to_luminance.d.ts.map +1 -0
- package/src/core/color/rgb_to_luminance.js +10 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts +1 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
- package/src/core/color/sRGB/linear_to_sRGB.js +4 -4
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +4 -1
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +3 -3
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +14 -14
- package/src/core/geom/3d/sphere/harmonics/README.md +16 -2
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts +6 -0
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.js +17 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.js +21 -9
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts +3 -3
- 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 +35 -206
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.js +29 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +10 -10
- package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_index.js +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +44 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +86 -0
- package/src/core/geom/3d/sphere/in_sphere3d_robust.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/in_sphere3d_robust.js +2 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +20 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +53 -7
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +2 -2
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +12 -7
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts +13 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +135 -0
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +38 -24
- package/src/core/geom/3d/tetrahedra/{compute_circumsphere.d.ts → tetrahedron_compute_circumsphere.d.ts} +3 -5
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/{compute_circumsphere.js → tetrahedron_compute_circumsphere.js} +2 -4
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +3 -1
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +4 -3
- package/src/core/geom/mat3/m3_multiply_vec3.d.ts +8 -0
- package/src/core/geom/mat3/m3_multiply_vec3.d.ts.map +1 -0
- package/src/core/geom/mat3/m3_multiply_vec3.js +21 -0
- package/src/core/geom/random/randomPointInSphere.d.ts +1 -1
- package/src/core/geom/random/randomPointInSphere.js +2 -2
- package/src/core/geom/random/randomPointOnSphere.d.ts +3 -3
- package/src/core/geom/random/randomPointOnSphere.d.ts.map +1 -1
- package/src/core/geom/random/randomPointOnSphere.js +5 -9
- package/src/core/geom/vec2/v2_cross_product.d.ts +15 -0
- package/src/core/geom/vec2/v2_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec2/v2_cross_product.js +21 -0
- package/src/core/geom/vec3/v3_slerp.d.ts +1 -0
- package/src/core/geom/vec3/v3_slerp.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_slerp.js +1 -0
- package/src/core/graph/MultiNode.d.ts +1 -1
- package/src/core/graph/MultiNode.js +1 -1
- package/src/core/graph/WeightedEdge.d.ts +6 -4
- package/src/core/graph/WeightedEdge.d.ts.map +1 -1
- package/src/core/graph/WeightedEdge.js +3 -0
- package/src/core/graph/coloring/colorizeGraph.js +19 -19
- package/src/core/graph/convert_graph_to_dot_string.d.ts +1 -1
- package/src/core/graph/convert_graph_to_dot_string.d.ts.map +1 -1
- package/src/core/graph/convert_graph_to_dot_string.js +10 -6
- package/src/core/graph/graph_compute_adjacency_matrix.d.ts +9 -0
- package/src/core/graph/graph_compute_adjacency_matrix.d.ts.map +1 -0
- package/src/core/graph/{graph_adjacency_matrix.js → graph_compute_adjacency_matrix.js} +1 -2
- package/src/core/graph/graph_compute_degree_matrix.d.ts +10 -0
- package/src/core/graph/graph_compute_degree_matrix.d.ts.map +1 -0
- package/src/core/graph/graph_compute_degree_matrix.js +23 -0
- package/src/core/graph/graph_compute_distance_matrix.d.ts +13 -0
- package/src/core/graph/graph_compute_distance_matrix.d.ts.map +1 -0
- package/src/core/graph/graph_compute_distance_matrix.js +103 -0
- package/src/core/graph/{graph_laplacian_matrix.d.ts → graph_compute_laplacian_matrix.d.ts} +2 -2
- package/src/core/graph/graph_compute_laplacian_matrix.d.ts.map +1 -0
- package/src/core/graph/{graph_laplacian_matrix.js → graph_compute_laplacian_matrix.js} +6 -6
- package/src/core/graph/graph_k_means_cluster.d.ts.map +1 -1
- package/src/core/graph/graph_k_means_cluster.js +4 -119
- package/src/core/graph/{coarsen_graph.d.ts → mn_graph_coarsen.d.ts} +2 -2
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -0
- package/src/core/graph/{coarsen_graph.js → mn_graph_coarsen.js} +1 -1
- package/src/core/graph/mn_graph_coarsen.spec.d.ts +2 -0
- package/src/core/graph/mn_graph_coarsen.spec.d.ts.map +1 -0
- package/src/core/graph/{coarsen_graph.spec.js → mn_graph_coarsen.spec.js} +4 -4
- package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts +1 -0
- package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts.map +1 -1
- package/src/core/graph/mn_graph_collapse_weighted_edge.js +7 -1
- package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
- package/src/core/math/physics/brdf/brdf_burley.js +9 -1
- package/src/core/math/physics/brdf/{D_GGX.d.ts → diffuse_GGX.d.ts} +2 -2
- package/src/core/math/physics/brdf/diffuse_GGX.d.ts.map +1 -0
- package/src/core/math/physics/brdf/{D_GGX.js → diffuse_GGX.js} +1 -1
- package/src/core/math/physics/brdf/fresnel_Schlick.d.ts +3 -0
- package/src/core/math/physics/brdf/fresnel_Schlick.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick.js +3 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts +9 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.js +12 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts +9 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.js +10 -0
- package/src/core/math/physics/bsdf/bsdf_schlick.d.ts.map +1 -1
- package/src/core/math/physics/bsdf/bsdf_schlick.js +3 -11
- package/src/core/math/physics/ior_to_reflectivity.d.ts +7 -0
- package/src/core/math/physics/ior_to_reflectivity.d.ts.map +1 -0
- package/src/core/math/physics/ior_to_reflectivity.js +9 -0
- package/src/core/math/physics/pdf/README.md +1 -0
- package/src/core/math/physics/pdf/pdf_GGX.d.ts +16 -0
- package/src/core/math/physics/pdf/pdf_GGX.d.ts.map +1 -0
- package/src/core/math/physics/pdf/pdf_GGX.js +25 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts +7 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -0
- package/src/core/math/physics/reflectivity_to_ior.js +8 -0
- package/src/core/process/task/util/randomCountTask.js +3 -3
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +5 -35
- package/src/engine/EngineHarness.d.ts +10 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +22 -11
- package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.js +17 -10
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts +25 -11
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/PNGReader.js +38 -24
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +5 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +4 -4
- package/src/engine/graphics/GraphicsEngine.js +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +4 -0
- package/src/engine/graphics/ecs/light/LightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSystem.js +2 -3
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts +6 -0
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +22 -11
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +7 -7
- package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +3 -3
- package/src/engine/graphics/render/forward_plus/model/DirectionalLight.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/DirectionalLight.js +25 -25
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -6
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts +9 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +145 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.js +51 -0
- package/src/engine/graphics/sh3/{LightProbeVolume.d.ts → lpv/LightProbeVolume.d.ts} +18 -7
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +340 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts +18 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.js +44 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +122 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts +29 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.js +35 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +27 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +158 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts +11 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +127 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +89 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +90 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +352 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +5 -91
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +41 -477
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.js +6 -3
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +38 -62
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +7 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.js +20 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.js +31 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.js +21 -0
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts +3 -0
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js +3 -0
- package/src/engine/graphics/sh3/path_tracer/texture/apply_texture_clamping_to_coordinate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{apply_texture_clamping_to_coordinate.js → texture/apply_texture_clamping_to_coordinate.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +11 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +86 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.js +55 -0
- package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +4 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +145 -185
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +5 -5
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +1 -1
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +8 -8
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +13 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +54 -0
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts +2 -2
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/AttributeDataTexture.js +11 -11
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +2 -2
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/network/convertPathToURL.d.ts +3 -1
- package/src/engine/network/convertPathToURL.d.ts.map +1 -1
- package/src/engine/network/convertPathToURL.js +68 -51
- package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
- package/src/engine/physics/fluid/SliceVisualiser.js +4 -4
- package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
- package/src/generation/filtering/numeric/CellFilterCache.js +1 -0
- package/src/view/elements/ColorPickerView.d.ts.map +1 -1
- package/src/view/elements/ColorPickerView.js +7 -7
- package/src/core/binary/float2uint8.d.ts +0 -7
- package/src/core/binary/float2uint8.d.ts.map +0 -1
- package/src/core/binary/uint82float.d.ts +0 -7
- package/src/core/binary/uint82float.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.d.ts +0 -2
- package/src/core/binary/uint82float.spec.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.js +0 -7
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts +0 -8
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts.map +0 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +0 -24
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts +0 -2
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts.map +0 -1
- package/src/core/geom/3d/tetrahedra/compute_circumsphere.d.ts.map +0 -1
- package/src/core/graph/coarsen_graph.d.ts.map +0 -1
- package/src/core/graph/coarsen_graph.spec.d.ts +0 -2
- package/src/core/graph/coarsen_graph.spec.d.ts.map +0 -1
- package/src/core/graph/graph_adjacency_matrix.d.ts +0 -9
- package/src/core/graph/graph_adjacency_matrix.d.ts.map +0 -1
- package/src/core/graph/graph_degree_matrix.d.ts +0 -9
- package/src/core/graph/graph_degree_matrix.d.ts.map +0 -1
- package/src/core/graph/graph_degree_matrix.js +0 -18
- package/src/core/graph/graph_laplacian_matrix.d.ts.map +0 -1
- package/src/core/math/physics/brdf/D_GGX.d.ts.map +0 -1
- package/src/engine/graphics/sh3/LightProbeVolume.d.ts.map +0 -1
- package/src/engine/graphics/sh3/LightProbeVolume.js +0 -609
- package/src/engine/graphics/sh3/path_tracer/apply_texture_clamping_to_coordinate.d.ts.map +0 -1
- package/src/engine/graphics/sh3/visualise_probe.d.ts +0 -12
- package/src/engine/graphics/sh3/visualise_probe.d.ts.map +0 -1
- package/src/engine/graphics/sh3/visualise_probe.js +0 -40
- /package/src/engine/graphics/sh3/path_tracer/{apply_texture_clamping_to_coordinate.d.ts → texture/apply_texture_clamping_to_coordinate.d.ts} +0 -0
|
@@ -97,7 +97,7 @@ function updateNN(NN, a, vertexCount, colors, colorNumber) {
|
|
|
97
97
|
|
|
98
98
|
const columnAddress = i * vertexCount;
|
|
99
99
|
|
|
100
|
-
for (
|
|
100
|
+
for (let j = 0; j < NN.length; j++) {
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
while (a[columnAddress + NN[j]] === 1) {
|
|
@@ -121,25 +121,25 @@ function updateNN(NN, a, vertexCount, colors, colorNumber) {
|
|
|
121
121
|
* @return {number[]}
|
|
122
122
|
*/
|
|
123
123
|
function findSuitableY(vertexCount, a, NN, color, colorNumber) {
|
|
124
|
-
|
|
124
|
+
let temp, tmp_y, y = 0;
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
const scanned = [];
|
|
127
127
|
|
|
128
128
|
let VerticesInCommon = 0;
|
|
129
129
|
|
|
130
|
-
for (
|
|
130
|
+
for (let i = 0; i < NN.length; i++) {
|
|
131
131
|
tmp_y = NN[i];
|
|
132
132
|
temp = 0;
|
|
133
133
|
|
|
134
|
-
for (
|
|
134
|
+
for (let f = 0; f < vertexCount; f++) {
|
|
135
135
|
scanned[f] = 0;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
for (
|
|
138
|
+
for (let x = 0; x < vertexCount; x++) {
|
|
139
139
|
|
|
140
140
|
if (color[x] === colorNumber) {
|
|
141
141
|
|
|
142
|
-
for (
|
|
142
|
+
for (let k = 0; k < vertexCount; k++) {
|
|
143
143
|
|
|
144
144
|
if (color[k] === 0 && scanned[k] === 0) {
|
|
145
145
|
|
|
@@ -174,12 +174,12 @@ function findSuitableY(vertexCount, a, NN, color, colorNumber) {
|
|
|
174
174
|
*/
|
|
175
175
|
function computeMaxDegreeInNN(NN, colors, degree) {
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
let max = -1;
|
|
178
|
+
let max_i, i;
|
|
179
179
|
|
|
180
180
|
const l = NN.length;
|
|
181
181
|
|
|
182
|
-
for (
|
|
182
|
+
for (let k = 0; k < l; k++) {
|
|
183
183
|
i = NN[k];
|
|
184
184
|
|
|
185
185
|
if ((colors[i] === 0) && (degree[i] > max)) {
|
|
@@ -201,15 +201,15 @@ function computeMaxDegreeInNN(NN, colors, degree) {
|
|
|
201
201
|
function colorizing(a, vertexCount) {
|
|
202
202
|
const NN = [];
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
const colors = [];
|
|
205
|
+
const degrees = [];
|
|
206
206
|
|
|
207
|
-
for (
|
|
207
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
208
208
|
|
|
209
209
|
colors[i] = 0;
|
|
210
210
|
degrees[i] = 0;
|
|
211
211
|
|
|
212
|
-
for (
|
|
212
|
+
for (let j = 0; j < vertexCount; j++) {
|
|
213
213
|
const address = i * vertexCount + j;
|
|
214
214
|
|
|
215
215
|
if (a[address] === 1) {
|
|
@@ -220,11 +220,11 @@ function colorizing(a, vertexCount) {
|
|
|
220
220
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
let x, y;
|
|
224
|
+
let result;
|
|
225
|
+
let colorNumber = 0;
|
|
226
|
+
let VerticesInCommon = 0;
|
|
227
|
+
let unprocessed = vertexCount;
|
|
228
228
|
|
|
229
229
|
while (unprocessed > 0) {
|
|
230
230
|
x = computeMaxDegreeVertex(vertexCount, colors, degrees);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert_graph_to_dot_string.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/convert_graph_to_dot_string.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert_graph_to_dot_string.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/convert_graph_to_dot_string.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,0FAFa,MAAM,CAgElB"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import LineBuilder from "../codegen/LineBuilder.js";
|
|
2
2
|
import { EdgeDirectionType } from "./Edge.js";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @template T
|
|
6
|
+
* @param {T} node
|
|
7
|
+
* @return {string}
|
|
8
|
+
*/
|
|
9
|
+
function defaultNodeToDot(node) {
|
|
6
10
|
return `[label="${node.toString()}"]`;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
|
-
* @template Node
|
|
11
14
|
* Build a Graphviz DOT representation of the graph
|
|
15
|
+
* @template Node
|
|
12
16
|
* @param {Graph<Node>} graph
|
|
13
17
|
* @param {function(Node):string} nodeToDot
|
|
14
18
|
* @returns {string}
|
|
15
19
|
*/
|
|
16
20
|
export function convert_graph_to_dot_string({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}) {
|
|
21
|
+
graph,
|
|
22
|
+
nodeToDot = defaultNodeToDot
|
|
23
|
+
}) {
|
|
20
24
|
const lb = new LineBuilder();
|
|
21
25
|
|
|
22
26
|
lb.add('strict digraph Graph {');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE: does not clear matrix before writing adjacency
|
|
3
|
+
* @template T
|
|
4
|
+
* @param {Graph<T>} graph
|
|
5
|
+
* @param {SquareMatrix} result
|
|
6
|
+
* @param {Map<T,number>} node_indices
|
|
7
|
+
*/
|
|
8
|
+
export function graph_compute_adjacency_matrix<T>(graph: Graph<T>, result: SquareMatrix, node_indices: Map<T, number>): void;
|
|
9
|
+
//# sourceMappingURL=graph_compute_adjacency_matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_compute_adjacency_matrix.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_compute_adjacency_matrix.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,6HAUC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//
|
|
2
1
|
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -8,7 +7,7 @@
|
|
|
8
7
|
* @param {SquareMatrix} result
|
|
9
8
|
* @param {Map<T,number>} node_indices
|
|
10
9
|
*/
|
|
11
|
-
export function
|
|
10
|
+
export function graph_compute_adjacency_matrix(graph, result, node_indices) {
|
|
12
11
|
const edges = graph.getEdges();
|
|
13
12
|
|
|
14
13
|
for (const edge of edges) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a matrix with node cardinality for each Node, that is, number of edges attached to each Node
|
|
3
|
+
* NOTE: does not clear matrix before writing
|
|
4
|
+
* @template T
|
|
5
|
+
* @param {Graph<T>} graph
|
|
6
|
+
* @param {SquareMatrix} result Where to store the result
|
|
7
|
+
* @param {Map<T,number>} node_indices de-referencing dictionary from Node to unsigned integer index
|
|
8
|
+
*/
|
|
9
|
+
export function graph_compute_degree_matrix<T>(graph: Graph<T>, result: SquareMatrix, node_indices: Map<T, number>): void;
|
|
10
|
+
//# sourceMappingURL=graph_compute_degree_matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_compute_degree_matrix.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_compute_degree_matrix.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0HAYC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builds a matrix with node cardinality for each Node, that is, number of edges attached to each Node
|
|
5
|
+
* NOTE: does not clear matrix before writing
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {Graph<T>} graph
|
|
8
|
+
* @param {SquareMatrix} result Where to store the result
|
|
9
|
+
* @param {Map<T,number>} node_indices de-referencing dictionary from Node to unsigned integer index
|
|
10
|
+
*/
|
|
11
|
+
export function graph_compute_degree_matrix(graph, result, node_indices) {
|
|
12
|
+
const nodes = graph.getNodes();
|
|
13
|
+
|
|
14
|
+
for (const node of nodes) {
|
|
15
|
+
const node_index = node_indices.get(node);
|
|
16
|
+
|
|
17
|
+
assert.isNonNegativeInteger(node_index, 'index');
|
|
18
|
+
|
|
19
|
+
const degree = graph.getNodeDegree(node);
|
|
20
|
+
|
|
21
|
+
result.setCellValue(node_index, node_index, degree);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Produce a distance matrix from an input graph, tracing distances from each node to every node specified in target vector
|
|
3
|
+
* @see "A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks" by Wei Peng et Al. 2012
|
|
4
|
+
* @template T
|
|
5
|
+
* @param {Graph<T>} graph
|
|
6
|
+
* @param {T[]} node_array graph nodes as an array
|
|
7
|
+
* @param {number[]} targets node indices, distances to which need to be calculated
|
|
8
|
+
* @param {Map<T, number>} node_index_map
|
|
9
|
+
* @returns {SquareMatrix}
|
|
10
|
+
*/
|
|
11
|
+
export function graph_compute_distance_matrix<T>(graph: Graph<T>, node_array: T[], targets: number[], node_index_map: Map<T, number>): SquareMatrix;
|
|
12
|
+
import { SquareMatrix } from "./SquareMatrix.js";
|
|
13
|
+
//# sourceMappingURL=graph_compute_distance_matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_compute_distance_matrix.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_compute_distance_matrix.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,4FAJW,MAAM,EAAE,mCAEN,YAAY,CAyFxB;6BAnG4B,mBAAmB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { BitSet } from "../binary/BitSet.js";
|
|
2
|
+
import { BinaryDataType } from "../binary/type/BinaryDataType.js";
|
|
3
|
+
import FastBinaryHeap from "../collection/heap/FastBinaryHeap.js";
|
|
4
|
+
import { SquareMatrix } from "./SquareMatrix.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Produce a distance matrix from an input graph, tracing distances from each node to every node specified in target vector
|
|
8
|
+
* @see "A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks" by Wei Peng et Al. 2012
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {Graph<T>} graph
|
|
11
|
+
* @param {T[]} node_array graph nodes as an array
|
|
12
|
+
* @param {number[]} targets node indices, distances to which need to be calculated
|
|
13
|
+
* @param {Map<T, number>} node_index_map
|
|
14
|
+
* @returns {SquareMatrix}
|
|
15
|
+
*/
|
|
16
|
+
export function graph_compute_distance_matrix(graph, node_array, targets, node_index_map) {
|
|
17
|
+
const node_count = node_array.length;
|
|
18
|
+
|
|
19
|
+
const m_distances = new SquareMatrix(node_count, BinaryDataType.Float32);
|
|
20
|
+
|
|
21
|
+
const flags = BitSet.fixedSize(node_count);
|
|
22
|
+
|
|
23
|
+
// initialize distances
|
|
24
|
+
m_distances.fill(Number.POSITIVE_INFINITY);
|
|
25
|
+
|
|
26
|
+
let source_node;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {number} other_node
|
|
31
|
+
* @returns {number}
|
|
32
|
+
*/
|
|
33
|
+
function score(other_node) {
|
|
34
|
+
return m_distances.getCellValue(source_node, other_node);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (let i = 0; i < targets.length; i++) {
|
|
38
|
+
source_node = targets[i];
|
|
39
|
+
|
|
40
|
+
// distance to self is always 0
|
|
41
|
+
m_distances.setCellValue(source_node, source_node, 0);
|
|
42
|
+
|
|
43
|
+
const heap = new FastBinaryHeap(score);
|
|
44
|
+
heap.push(source_node);
|
|
45
|
+
|
|
46
|
+
while (!heap.isEmpty()) {
|
|
47
|
+
const t = heap.pop();
|
|
48
|
+
|
|
49
|
+
const distance_to_this_node = m_distances.getCellValue(source_node, t);
|
|
50
|
+
if (flags.get(t)) {
|
|
51
|
+
// already visited
|
|
52
|
+
for (let v = 0; v < node_count; v++) {
|
|
53
|
+
const shortcut_distance = distance_to_this_node + m_distances.getCellValue(t, v);
|
|
54
|
+
|
|
55
|
+
if (shortcut_distance < m_distances.getCellValue(source_node, v)) {
|
|
56
|
+
m_distances.setCellValue(source_node, v, shortcut_distance)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
// not visited yet
|
|
62
|
+
const t_node = node_array[t];
|
|
63
|
+
|
|
64
|
+
const t_node_container = graph.getNodeContainer(t_node);
|
|
65
|
+
|
|
66
|
+
const node_edges = t_node_container.getEdges();
|
|
67
|
+
const node_edge_count = node_edges.length;
|
|
68
|
+
|
|
69
|
+
for (let i1 = 0; i1 < node_edge_count; i1++) {
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @type {WeightedEdge<N>}
|
|
74
|
+
*/
|
|
75
|
+
const node_edge = node_edges[i1];
|
|
76
|
+
|
|
77
|
+
const neighbour_node = node_edge.other(t_node);
|
|
78
|
+
|
|
79
|
+
const neighbour_node_index = node_index_map.get(neighbour_node);
|
|
80
|
+
|
|
81
|
+
if (neighbour_node_index === -1) {
|
|
82
|
+
// not in the input set
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const transition_cost = node_edge.weight + 1e-5;
|
|
87
|
+
|
|
88
|
+
const distance_to_neighbour = distance_to_this_node + transition_cost;
|
|
89
|
+
|
|
90
|
+
if (distance_to_neighbour < m_distances.getCellValue(source_node, neighbour_node_index)) {
|
|
91
|
+
m_distances.setCellValue(source_node, neighbour_node_index, distance_to_neighbour);
|
|
92
|
+
|
|
93
|
+
heap.push(neighbour_node_index);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
flags.set(source_node, true);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return m_distances;
|
|
103
|
+
}
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @param {SquareMatrix} result
|
|
7
7
|
* @param {Map<T,number>} node_indices
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function graph_compute_laplacian_matrix<T>(graph: Graph<T>, result: SquareMatrix, node_indices: Map<T, number>): void;
|
|
10
10
|
import { SquareMatrix } from "./SquareMatrix.js";
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=graph_compute_laplacian_matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_compute_laplacian_matrix.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_compute_laplacian_matrix.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,2EAHW,YAAY,sCAWtB;6BAlB4B,mBAAmB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { graph_degree_matrix } from "./graph_degree_matrix.js";
|
|
2
|
-
import { SquareMatrix } from "./SquareMatrix.js";
|
|
3
1
|
import { BinaryDataType } from "../binary/type/BinaryDataType.js";
|
|
4
|
-
import {
|
|
2
|
+
import { graph_compute_adjacency_matrix } from "./graph_compute_adjacency_matrix.js";
|
|
3
|
+
import { graph_compute_degree_matrix } from "./graph_compute_degree_matrix.js";
|
|
4
|
+
import { SquareMatrix } from "./SquareMatrix.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Laplacian matrix (graph Laplacian)
|
|
@@ -11,12 +11,12 @@ import { graph_adjacency_matrix } from "./graph_adjacency_matrix.js";
|
|
|
11
11
|
* @param {SquareMatrix} result
|
|
12
12
|
* @param {Map<T,number>} node_indices
|
|
13
13
|
*/
|
|
14
|
-
export function
|
|
14
|
+
export function graph_compute_laplacian_matrix(graph, result, node_indices) {
|
|
15
15
|
const degree = new SquareMatrix(result.size, BinaryDataType.Uint8);
|
|
16
16
|
const adjacency = new SquareMatrix(result.size, BinaryDataType.Uint8);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
graph_compute_degree_matrix(graph, degree, node_indices);
|
|
19
|
+
graph_compute_adjacency_matrix(graph, adjacency, node_indices);
|
|
20
20
|
|
|
21
21
|
result.subtractMatrices(degree, adjacency);
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_k_means_cluster.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_k_means_cluster.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph_k_means_cluster.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/graph_k_means_cluster.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,2DARW,cAAc,KACd,MAAM,eACN,MAAM,4BACN,MAAM,EAAE,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,kBAC3C,OAAO,MAAM,CAAC,+BAEZ,MAAM,EAAE,EAAE,CA2EtB;AAED;;;;;;;GAOG;AACH,6DAJW,MAAM,eACN,MAAM,GACJ,MAAM,EAAE,EAAE,CA0BtB"}
|
|
@@ -1,122 +1,7 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { seededRandom } from "../math/random/seededRandom.js";
|
|
3
|
-
import { SquareMatrix } from "./SquareMatrix.js";
|
|
4
|
-
import { BinaryDataType } from "../binary/type/BinaryDataType.js";
|
|
5
|
-
import { BitSet } from "../binary/BitSet.js";
|
|
6
|
-
import FastBinaryHeap from "../collection/heap/FastBinaryHeap.js";
|
|
7
2
|
import { randomIntegerBetween } from "../math/random/randomIntegerBetween.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @template N
|
|
11
|
-
* @param {N} n0
|
|
12
|
-
* @param {N} n1
|
|
13
|
-
* @param {Graph<N>} graph
|
|
14
|
-
* @returns {number}
|
|
15
|
-
*/
|
|
16
|
-
function node_distance(n0, n1, graph) {
|
|
17
|
-
const path = graph.findPath(n0, n1);
|
|
18
|
-
|
|
19
|
-
if (path === null) {
|
|
20
|
-
return Number.POSITIVE_INFINITY;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return path.length;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Produce a distance matrix from an input graph, tracing distances from each node to every node specified in target vector
|
|
28
|
-
* @see "A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks" by Wei Peng et Al. 2012
|
|
29
|
-
* @template T
|
|
30
|
-
* @param {Graph<T>} graph
|
|
31
|
-
* @param {T[]} node_array graph nodes as an array
|
|
32
|
-
* @param {number[]} targets node indices, distances to which need to be calculated
|
|
33
|
-
* @param {Map<T, number>} node_index_map
|
|
34
|
-
* @returns {SquareMatrix}
|
|
35
|
-
*/
|
|
36
|
-
function build_distance_matrix(graph, node_array, targets, node_index_map) {
|
|
37
|
-
const node_count = node_array.length;
|
|
38
|
-
|
|
39
|
-
const m_distances = new SquareMatrix(node_count, BinaryDataType.Float32);
|
|
40
|
-
|
|
41
|
-
const flags = BitSet.fixedSize(node_count);
|
|
42
|
-
|
|
43
|
-
// initialize distances
|
|
44
|
-
m_distances.fill(Number.POSITIVE_INFINITY);
|
|
45
|
-
|
|
46
|
-
let source_node;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {number} other_node
|
|
51
|
-
* @returns {number}
|
|
52
|
-
*/
|
|
53
|
-
function score(other_node) {
|
|
54
|
-
return m_distances.getCellValue(source_node, other_node);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < targets.length; i++) {
|
|
58
|
-
source_node = targets[i];
|
|
59
|
-
|
|
60
|
-
// distance to self is always 0
|
|
61
|
-
m_distances.setCellValue(source_node, source_node, 0);
|
|
62
|
-
|
|
63
|
-
const heap = new FastBinaryHeap(score);
|
|
64
|
-
heap.push(source_node);
|
|
65
|
-
|
|
66
|
-
while (!heap.isEmpty()) {
|
|
67
|
-
const t = heap.pop();
|
|
68
|
-
|
|
69
|
-
const distance_to_this_node = m_distances.getCellValue(source_node, t);
|
|
70
|
-
if (flags.get(t)) {
|
|
71
|
-
// already visited
|
|
72
|
-
for (let v = 0; v < node_count; v++) {
|
|
73
|
-
const shortcut_distance = distance_to_this_node + m_distances.getCellValue(t, v);
|
|
74
|
-
|
|
75
|
-
if (shortcut_distance < m_distances.getCellValue(source_node, v)) {
|
|
76
|
-
m_distances.setCellValue(source_node, v, shortcut_distance)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
// not visited yet
|
|
82
|
-
const t_node = node_array[t];
|
|
83
|
-
|
|
84
|
-
const t_node_container = graph.getNodeContainer(t_node);
|
|
85
|
-
|
|
86
|
-
const node_edges = t_node_container.getEdges();
|
|
87
|
-
const node_edge_count = node_edges.length;
|
|
88
|
-
|
|
89
|
-
for (let i1 = 0; i1 < node_edge_count; i1++) {
|
|
90
|
-
|
|
91
|
-
const node_edge = node_edges[i1];
|
|
92
|
-
|
|
93
|
-
const neighbour_node = node_edge.other(t_node);
|
|
94
|
-
|
|
95
|
-
const neighbour_node_index = node_index_map.get(neighbour_node);
|
|
96
|
-
|
|
97
|
-
if (neighbour_node_index === -1) {
|
|
98
|
-
// not in the input set
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const transition_cost = node_edge.weight + 1e-5;
|
|
103
|
-
|
|
104
|
-
const distance_to_neighbour = distance_to_this_node + transition_cost;
|
|
105
|
-
|
|
106
|
-
if (distance_to_neighbour < m_distances.getCellValue(source_node, neighbour_node_index)) {
|
|
107
|
-
m_distances.setCellValue(source_node, neighbour_node_index, distance_to_neighbour);
|
|
108
|
-
|
|
109
|
-
heap.push(neighbour_node_index);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
flags.set(source_node, true);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return m_distances;
|
|
119
|
-
}
|
|
3
|
+
import { seededRandom } from "../math/random/seededRandom.js";
|
|
4
|
+
import { graph_compute_distance_matrix } from "./graph_compute_distance_matrix.js";
|
|
120
5
|
|
|
121
6
|
|
|
122
7
|
/**
|
|
@@ -172,7 +57,7 @@ export function graph_k_means_cluster_detailed(
|
|
|
172
57
|
clusters[i] = [node_index];
|
|
173
58
|
}
|
|
174
59
|
|
|
175
|
-
const m_distances =
|
|
60
|
+
const m_distances = graph_compute_distance_matrix(graph, node_array, clusters_seeds, node_index_map);
|
|
176
61
|
|
|
177
62
|
for (let node_index = 0; node_index < total_node_count; node_index++) {
|
|
178
63
|
|
|
@@ -218,7 +103,7 @@ export function graph_k_means_cluster(graph, k, random_seed) {
|
|
|
218
103
|
|
|
219
104
|
/**
|
|
220
105
|
*
|
|
221
|
-
* @type {
|
|
106
|
+
* @type {Uint8Array}
|
|
222
107
|
*/
|
|
223
108
|
const node_cluster_assignments = new Uint8Array(node_count);
|
|
224
109
|
// fill with "UNASSIGNED" value
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @param {Graph<MultiNode<T>>} graph
|
|
6
6
|
* @param {number} max_node_limit Maximum number of "source" nodes per joined node
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export function mn_graph_coarsen<T>(graph: Graph<MultiNode<T>>, max_node_limit: number): void;
|
|
9
|
+
//# sourceMappingURL=mn_graph_coarsen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mn_graph_coarsen.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_coarsen.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,gFAFW,MAAM,QAuBhB"}
|
|
@@ -9,7 +9,7 @@ import { WeightedEdge } from "./WeightedEdge.js";
|
|
|
9
9
|
* @param {Graph<MultiNode<T>>} graph
|
|
10
10
|
* @param {number} max_node_limit Maximum number of "source" nodes per joined node
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function mn_graph_coarsen(graph, max_node_limit) {
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mn_graph_coarsen.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_coarsen.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mn_graph_coarsen } from "./mn_graph_coarsen.js";
|
|
2
2
|
import { MultiNode } from "./MultiNode.js";
|
|
3
|
+
import { Graph } from "./v2/Graph.js";
|
|
3
4
|
import { WeightedEdge } from "./WeightedEdge.js";
|
|
4
|
-
import { coarsen_graph } from "./coarsen_graph.js";
|
|
5
5
|
|
|
6
6
|
test('coarsen 2 node graph with 1 edge', () => {
|
|
7
7
|
const graph = new Graph();
|
|
@@ -13,7 +13,7 @@ test('coarsen 2 node graph with 1 edge', () => {
|
|
|
13
13
|
|
|
14
14
|
graph.addEdge(new WeightedEdge(n0, n1));
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
mn_graph_coarsen(graph, 2);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('coarsen chain, all nodes must still be linked', () => {
|
|
@@ -37,7 +37,7 @@ test('coarsen chain, all nodes must still be linked', () => {
|
|
|
37
37
|
g.addEdge(new WeightedEdge(n0, n1));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
mn_graph_coarsen(g, 100);
|
|
41
41
|
|
|
42
42
|
expect(g.getNodeCount()).toBe(1);
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mn_graph_collapse_weighted_edge.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_collapse_weighted_edge.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mn_graph_collapse_weighted_edge.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_collapse_weighted_edge.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,+HAJW,MAAM,2BAEJ,OAAO,CAyEnB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Multi-node graph function
|
|
2
3
|
* @template N
|
|
3
4
|
* @param {Graph<MultiNode<N>>} graph
|
|
4
5
|
* @param {WeightedEdge<MultiNode<N>>} edge
|
|
@@ -6,7 +7,12 @@
|
|
|
6
7
|
* @param {BinaryHeap<Edge>} heap
|
|
7
8
|
* @returns {boolean} whether collapse was performed or rejected
|
|
8
9
|
*/
|
|
9
|
-
export function mn_graph_collapse_weighted_edge(
|
|
10
|
+
export function mn_graph_collapse_weighted_edge(
|
|
11
|
+
graph,
|
|
12
|
+
edge,
|
|
13
|
+
source_limit,
|
|
14
|
+
heap
|
|
15
|
+
) {
|
|
10
16
|
|
|
11
17
|
const successor_node = edge.first;
|
|
12
18
|
const victim_node = edge.second;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
2
|
+
import { fresnel_Schlick } from "./fresnel_Schlick.js";
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} u
|
|
7
|
+
* @param {number} f0
|
|
8
|
+
* @param {number} f90
|
|
9
|
+
* @return {number}
|
|
10
|
+
*/
|
|
3
11
|
function F_Schlick(u, f0, f90) {
|
|
4
12
|
|
|
5
|
-
return f0 + (f90 - f0) *
|
|
13
|
+
return f0 + (f90 - f0) * fresnel_Schlick(u);
|
|
6
14
|
}
|
|
7
15
|
|
|
8
16
|
/**
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @param {number} roughness
|
|
6
6
|
* @returns {number}
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export function diffuse_GGX(NoH: number, roughness: number): number;
|
|
9
|
+
//# sourceMappingURL=diffuse_GGX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diffuse_GGX.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/diffuse_GGX.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,iCAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -7,7 +7,7 @@ import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
|
7
7
|
* @param {number} roughness
|
|
8
8
|
* @returns {number}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function diffuse_GGX(NoH, roughness) {
|
|
11
11
|
const a = NoH * roughness;
|
|
12
12
|
|
|
13
13
|
const k = roughness / (1 - NoH * NoH + a * a);
|