@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.
Files changed (315) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/meep.cjs +255 -172
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +255 -173
  5. package/editor/tools/paint/TerrainHeightPaintTool.js +5 -5
  6. package/package.json +1 -1
  7. package/src/core/binary/float_to_uint8.d.ts +7 -0
  8. package/src/core/binary/float_to_uint8.d.ts.map +1 -0
  9. package/src/core/binary/{float2uint8.js → float_to_uint8.js} +1 -1
  10. package/src/core/binary/int32_to_binary_string.d.ts +3 -2
  11. package/src/core/binary/int32_to_binary_string.d.ts.map +1 -1
  12. package/src/core/binary/int32_to_binary_string.js +18 -14
  13. package/src/core/binary/split_by_3.spec.d.ts +2 -0
  14. package/src/core/binary/split_by_3.spec.d.ts.map +1 -0
  15. package/src/core/binary/split_by_3.spec.js +22 -0
  16. package/src/core/binary/to_half_float_uint16.d.ts.map +1 -1
  17. package/src/core/binary/to_half_float_uint16.js +7 -5
  18. package/src/core/binary/uint8_to_float.d.ts +7 -0
  19. package/src/core/binary/uint8_to_float.d.ts.map +1 -0
  20. package/src/core/binary/{uint82float.js → uint8_to_float.js} +1 -1
  21. package/src/core/binary/uint8_to_float.spec.d.ts +2 -0
  22. package/src/core/binary/uint8_to_float.spec.d.ts.map +1 -0
  23. package/src/core/binary/uint8_to_float.spec.js +7 -0
  24. package/src/core/codegen/codeToBlob.d.ts +8 -0
  25. package/src/core/codegen/codeToBlob.d.ts.map +1 -0
  26. package/src/core/codegen/codeToBlob.js +36 -0
  27. package/src/core/codegen/codeToURL.d.ts +8 -0
  28. package/src/core/codegen/codeToURL.d.ts.map +1 -0
  29. package/src/core/codegen/codeToURL.js +22 -0
  30. package/src/core/collection/array/array_shuffle.d.ts +8 -0
  31. package/src/core/collection/array/array_shuffle.d.ts.map +1 -0
  32. package/src/core/collection/array/array_shuffle.js +22 -0
  33. package/src/core/collection/array/array_shuffle.spec.d.ts +2 -0
  34. package/src/core/collection/array/array_shuffle.spec.d.ts.map +1 -0
  35. package/src/core/collection/array/{randomizeArrayElementOrder.spec.js → array_shuffle.spec.js} +4 -4
  36. package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
  37. package/src/core/collection/array/isArrayEqualStrict.js +2 -2
  38. package/src/core/collection/array/iterator/ArrayIteratorRandom.js +2 -2
  39. package/src/core/collection/array/randomMultipleFromArray.js +2 -2
  40. package/src/core/color/Color.d.ts.map +1 -1
  41. package/src/core/color/Color.js +16 -11
  42. package/src/core/color/hsv/hsv2rgb.js +4 -4
  43. package/src/core/color/hsv/rgb2hsv.d.ts +3 -3
  44. package/src/core/color/hsv/rgb2hsv.d.ts.map +1 -1
  45. package/src/core/color/hsv/rgb2hsv.js +11 -18
  46. package/src/core/color/rgb2uint24.js +4 -4
  47. package/src/core/color/rgb_to_luminance.d.ts +9 -0
  48. package/src/core/color/rgb_to_luminance.d.ts.map +1 -0
  49. package/src/core/color/rgb_to_luminance.js +10 -0
  50. package/src/core/color/sRGB/linear_to_sRGB.d.ts +1 -0
  51. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  52. package/src/core/color/sRGB/linear_to_sRGB.js +4 -4
  53. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  54. package/src/core/geom/3d/aabb/AABB3.js +4 -1
  55. package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +3 -3
  56. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
  57. package/src/core/geom/3d/shape/UnitSphereShape3D.js +14 -14
  58. package/src/core/geom/3d/sphere/harmonics/README.md +16 -2
  59. package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts +6 -0
  60. package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts.map +1 -0
  61. package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.js +17 -0
  62. package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.d.ts.map +1 -1
  63. package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.js +21 -9
  64. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts +3 -3
  65. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
  66. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +35 -206
  67. package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +8 -0
  68. package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +1 -0
  69. package/src/core/geom/3d/sphere/harmonics/sh3_rotate.js +29 -0
  70. package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +10 -10
  71. package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts +8 -0
  72. package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts.map +1 -0
  73. package/src/core/geom/3d/sphere/harmonics/sh_index.js +9 -0
  74. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +8 -0
  75. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +1 -0
  76. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +44 -0
  77. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +8 -0
  78. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +1 -0
  79. package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +86 -0
  80. package/src/core/geom/3d/sphere/in_sphere3d_robust.d.ts.map +1 -1
  81. package/src/core/geom/3d/sphere/in_sphere3d_robust.js +2 -1
  82. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +20 -1
  83. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
  84. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +53 -7
  85. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +2 -2
  86. package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts +1 -1
  87. package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts.map +1 -1
  88. package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +12 -7
  89. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts +13 -0
  90. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -0
  91. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +135 -0
  92. package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +38 -24
  93. package/src/core/geom/3d/tetrahedra/{compute_circumsphere.d.ts → tetrahedron_compute_circumsphere.d.ts} +3 -5
  94. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -0
  95. package/src/core/geom/3d/tetrahedra/{compute_circumsphere.js → tetrahedron_compute_circumsphere.js} +2 -4
  96. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.d.ts.map +1 -1
  97. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +3 -1
  98. package/src/core/geom/Vector3.d.ts.map +1 -1
  99. package/src/core/geom/Vector3.js +4 -3
  100. package/src/core/geom/mat3/m3_multiply_vec3.d.ts +8 -0
  101. package/src/core/geom/mat3/m3_multiply_vec3.d.ts.map +1 -0
  102. package/src/core/geom/mat3/m3_multiply_vec3.js +21 -0
  103. package/src/core/geom/random/randomPointInSphere.d.ts +1 -1
  104. package/src/core/geom/random/randomPointInSphere.js +2 -2
  105. package/src/core/geom/random/randomPointOnSphere.d.ts +3 -3
  106. package/src/core/geom/random/randomPointOnSphere.d.ts.map +1 -1
  107. package/src/core/geom/random/randomPointOnSphere.js +5 -9
  108. package/src/core/geom/vec2/v2_cross_product.d.ts +15 -0
  109. package/src/core/geom/vec2/v2_cross_product.d.ts.map +1 -0
  110. package/src/core/geom/vec2/v2_cross_product.js +21 -0
  111. package/src/core/geom/vec3/v3_slerp.d.ts +1 -0
  112. package/src/core/geom/vec3/v3_slerp.d.ts.map +1 -1
  113. package/src/core/geom/vec3/v3_slerp.js +1 -0
  114. package/src/core/graph/MultiNode.d.ts +1 -1
  115. package/src/core/graph/MultiNode.js +1 -1
  116. package/src/core/graph/WeightedEdge.d.ts +6 -4
  117. package/src/core/graph/WeightedEdge.d.ts.map +1 -1
  118. package/src/core/graph/WeightedEdge.js +3 -0
  119. package/src/core/graph/coloring/colorizeGraph.js +19 -19
  120. package/src/core/graph/convert_graph_to_dot_string.d.ts +1 -1
  121. package/src/core/graph/convert_graph_to_dot_string.d.ts.map +1 -1
  122. package/src/core/graph/convert_graph_to_dot_string.js +10 -6
  123. package/src/core/graph/graph_compute_adjacency_matrix.d.ts +9 -0
  124. package/src/core/graph/graph_compute_adjacency_matrix.d.ts.map +1 -0
  125. package/src/core/graph/{graph_adjacency_matrix.js → graph_compute_adjacency_matrix.js} +1 -2
  126. package/src/core/graph/graph_compute_degree_matrix.d.ts +10 -0
  127. package/src/core/graph/graph_compute_degree_matrix.d.ts.map +1 -0
  128. package/src/core/graph/graph_compute_degree_matrix.js +23 -0
  129. package/src/core/graph/graph_compute_distance_matrix.d.ts +13 -0
  130. package/src/core/graph/graph_compute_distance_matrix.d.ts.map +1 -0
  131. package/src/core/graph/graph_compute_distance_matrix.js +103 -0
  132. package/src/core/graph/{graph_laplacian_matrix.d.ts → graph_compute_laplacian_matrix.d.ts} +2 -2
  133. package/src/core/graph/graph_compute_laplacian_matrix.d.ts.map +1 -0
  134. package/src/core/graph/{graph_laplacian_matrix.js → graph_compute_laplacian_matrix.js} +6 -6
  135. package/src/core/graph/graph_k_means_cluster.d.ts.map +1 -1
  136. package/src/core/graph/graph_k_means_cluster.js +4 -119
  137. package/src/core/graph/{coarsen_graph.d.ts → mn_graph_coarsen.d.ts} +2 -2
  138. package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -0
  139. package/src/core/graph/{coarsen_graph.js → mn_graph_coarsen.js} +1 -1
  140. package/src/core/graph/mn_graph_coarsen.spec.d.ts +2 -0
  141. package/src/core/graph/mn_graph_coarsen.spec.d.ts.map +1 -0
  142. package/src/core/graph/{coarsen_graph.spec.js → mn_graph_coarsen.spec.js} +4 -4
  143. package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts +1 -0
  144. package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts.map +1 -1
  145. package/src/core/graph/mn_graph_collapse_weighted_edge.js +7 -1
  146. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  147. package/src/core/math/physics/brdf/brdf_burley.js +9 -1
  148. package/src/core/math/physics/brdf/{D_GGX.d.ts → diffuse_GGX.d.ts} +2 -2
  149. package/src/core/math/physics/brdf/diffuse_GGX.d.ts.map +1 -0
  150. package/src/core/math/physics/brdf/{D_GGX.js → diffuse_GGX.js} +1 -1
  151. package/src/core/math/physics/brdf/fresnel_Schlick.d.ts +3 -0
  152. package/src/core/math/physics/brdf/fresnel_Schlick.d.ts.map +1 -0
  153. package/src/core/math/physics/brdf/fresnel_Schlick.js +3 -0
  154. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts +9 -0
  155. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts.map +1 -0
  156. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.js +12 -0
  157. package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts +9 -0
  158. package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts.map +1 -0
  159. package/src/core/math/physics/brdf/fresnel_Schlick_original.js +10 -0
  160. package/src/core/math/physics/bsdf/bsdf_schlick.d.ts.map +1 -1
  161. package/src/core/math/physics/bsdf/bsdf_schlick.js +3 -11
  162. package/src/core/math/physics/ior_to_reflectivity.d.ts +7 -0
  163. package/src/core/math/physics/ior_to_reflectivity.d.ts.map +1 -0
  164. package/src/core/math/physics/ior_to_reflectivity.js +9 -0
  165. package/src/core/math/physics/pdf/README.md +1 -0
  166. package/src/core/math/physics/pdf/pdf_GGX.d.ts +16 -0
  167. package/src/core/math/physics/pdf/pdf_GGX.d.ts.map +1 -0
  168. package/src/core/math/physics/pdf/pdf_GGX.js +25 -0
  169. package/src/core/math/physics/reflectivity_to_ior.d.ts +7 -0
  170. package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -0
  171. package/src/core/math/physics/reflectivity_to_ior.js +8 -0
  172. package/src/core/process/task/util/randomCountTask.js +3 -3
  173. package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
  174. package/src/core/process/worker/WorkerBuilder.js +5 -35
  175. package/src/engine/EngineHarness.d.ts +10 -1
  176. package/src/engine/EngineHarness.d.ts.map +1 -1
  177. package/src/engine/EngineHarness.js +22 -11
  178. package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
  179. package/src/engine/asset/loaders/ArrayBufferLoader.js +17 -10
  180. package/src/engine/asset/loaders/image/png/PNGReader.d.ts +25 -11
  181. package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
  182. package/src/engine/asset/loaders/image/png/PNGReader.js +38 -24
  183. package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.d.ts.map +1 -1
  184. package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +5 -0
  185. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +4 -4
  186. package/src/engine/graphics/GraphicsEngine.js +1 -1
  187. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
  188. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +4 -0
  189. package/src/engine/graphics/ecs/light/LightSystem.d.ts.map +1 -1
  190. package/src/engine/graphics/ecs/light/LightSystem.js +2 -3
  191. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts +6 -0
  192. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
  193. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +22 -11
  194. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
  195. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +7 -7
  196. package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +3 -3
  197. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.d.ts.map +1 -1
  198. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.js +25 -25
  199. package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +1 -1
  200. package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -6
  201. package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts +9 -0
  202. package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -0
  203. package/src/engine/graphics/sh3/fromCubeRenderTarget.js +145 -0
  204. package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts +8 -0
  205. package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts.map +1 -0
  206. package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.js +51 -0
  207. package/src/engine/graphics/sh3/{LightProbeVolume.d.ts → lpv/LightProbeVolume.d.ts} +18 -7
  208. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -0
  209. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +340 -0
  210. package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts +18 -0
  211. package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
  212. package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.js +44 -0
  213. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +12 -0
  214. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -0
  215. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +122 -0
  216. package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts +29 -0
  217. package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts.map +1 -0
  218. package/src/engine/graphics/sh3/lpv/ProbeRenderer.js +35 -0
  219. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +27 -0
  220. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -0
  221. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +158 -0
  222. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts +11 -0
  223. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -0
  224. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +127 -0
  225. package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +12 -0
  226. package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -0
  227. package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +89 -0
  228. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +90 -0
  229. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -0
  230. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +352 -0
  231. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +5 -91
  232. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
  233. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +41 -477
  234. package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts +1 -0
  235. package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts.map +1 -1
  236. package/src/engine/graphics/sh3/path_tracer/make_one_vector3.js +6 -3
  237. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +38 -62
  238. package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +1 -1
  239. package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +7 -1
  240. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
  241. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +1 -1
  242. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +1 -1
  243. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts +10 -0
  244. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts.map +1 -0
  245. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.js +20 -0
  246. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts +10 -0
  247. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts.map +1 -0
  248. package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.js +31 -0
  249. package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts +9 -0
  250. package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts.map +1 -0
  251. package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.js +21 -0
  252. package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts +3 -0
  253. package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts.map +1 -0
  254. package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js +3 -0
  255. package/src/engine/graphics/sh3/path_tracer/texture/apply_texture_clamping_to_coordinate.d.ts.map +1 -0
  256. package/src/engine/graphics/sh3/path_tracer/{apply_texture_clamping_to_coordinate.js → texture/apply_texture_clamping_to_coordinate.js} +2 -2
  257. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +11 -0
  258. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -0
  259. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +86 -0
  260. package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts +10 -0
  261. package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts.map +1 -0
  262. package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.js +55 -0
  263. package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +4 -4
  264. package/src/engine/graphics/sh3/prototypeSH3Probe.js +145 -185
  265. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +5 -5
  266. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +1 -1
  267. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +8 -8
  268. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +13 -0
  269. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -0
  270. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +54 -0
  271. package/src/engine/graphics/texture/AttributeDataTexture.d.ts +2 -2
  272. package/src/engine/graphics/texture/AttributeDataTexture.d.ts.map +1 -1
  273. package/src/engine/graphics/texture/AttributeDataTexture.js +11 -11
  274. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  275. package/src/engine/graphics/texture/sampler/Sampler2D.js +2 -2
  276. package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
  277. package/src/engine/network/convertPathToURL.d.ts +3 -1
  278. package/src/engine/network/convertPathToURL.d.ts.map +1 -1
  279. package/src/engine/network/convertPathToURL.js +68 -51
  280. package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
  281. package/src/engine/physics/fluid/SliceVisualiser.js +4 -4
  282. package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
  283. package/src/generation/filtering/numeric/CellFilterCache.js +1 -0
  284. package/src/view/elements/ColorPickerView.d.ts.map +1 -1
  285. package/src/view/elements/ColorPickerView.js +7 -7
  286. package/src/core/binary/float2uint8.d.ts +0 -7
  287. package/src/core/binary/float2uint8.d.ts.map +0 -1
  288. package/src/core/binary/uint82float.d.ts +0 -7
  289. package/src/core/binary/uint82float.d.ts.map +0 -1
  290. package/src/core/binary/uint82float.spec.d.ts +0 -2
  291. package/src/core/binary/uint82float.spec.d.ts.map +0 -1
  292. package/src/core/binary/uint82float.spec.js +0 -7
  293. package/src/core/collection/array/randomizeArrayElementOrder.d.ts +0 -8
  294. package/src/core/collection/array/randomizeArrayElementOrder.d.ts.map +0 -1
  295. package/src/core/collection/array/randomizeArrayElementOrder.js +0 -24
  296. package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts +0 -2
  297. package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts.map +0 -1
  298. package/src/core/geom/3d/tetrahedra/compute_circumsphere.d.ts.map +0 -1
  299. package/src/core/graph/coarsen_graph.d.ts.map +0 -1
  300. package/src/core/graph/coarsen_graph.spec.d.ts +0 -2
  301. package/src/core/graph/coarsen_graph.spec.d.ts.map +0 -1
  302. package/src/core/graph/graph_adjacency_matrix.d.ts +0 -9
  303. package/src/core/graph/graph_adjacency_matrix.d.ts.map +0 -1
  304. package/src/core/graph/graph_degree_matrix.d.ts +0 -9
  305. package/src/core/graph/graph_degree_matrix.d.ts.map +0 -1
  306. package/src/core/graph/graph_degree_matrix.js +0 -18
  307. package/src/core/graph/graph_laplacian_matrix.d.ts.map +0 -1
  308. package/src/core/math/physics/brdf/D_GGX.d.ts.map +0 -1
  309. package/src/engine/graphics/sh3/LightProbeVolume.d.ts.map +0 -1
  310. package/src/engine/graphics/sh3/LightProbeVolume.js +0 -609
  311. package/src/engine/graphics/sh3/path_tracer/apply_texture_clamping_to_coordinate.d.ts.map +0 -1
  312. package/src/engine/graphics/sh3/visualise_probe.d.ts +0 -12
  313. package/src/engine/graphics/sh3/visualise_probe.d.ts.map +0 -1
  314. package/src/engine/graphics/sh3/visualise_probe.js +0 -40
  315. /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 (var j = 0; j < NN.length; j++) {
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
- var temp, tmp_y, y = 0;
124
+ let temp, tmp_y, y = 0;
125
125
 
126
- var scanned = [];
126
+ const scanned = [];
127
127
 
128
128
  let VerticesInCommon = 0;
129
129
 
130
- for (var i = 0; i < NN.length; i++) {
130
+ for (let i = 0; i < NN.length; i++) {
131
131
  tmp_y = NN[i];
132
132
  temp = 0;
133
133
 
134
- for (var f = 0; f < vertexCount; f++) {
134
+ for (let f = 0; f < vertexCount; f++) {
135
135
  scanned[f] = 0;
136
136
  }
137
137
 
138
- for (var x = 0; x < vertexCount; x++) {
138
+ for (let x = 0; x < vertexCount; x++) {
139
139
 
140
140
  if (color[x] === colorNumber) {
141
141
 
142
- for (var k = 0; k < vertexCount; k++) {
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
- var max = -1;
178
- var max_i, i;
177
+ let max = -1;
178
+ let max_i, i;
179
179
 
180
180
  const l = NN.length;
181
181
 
182
- for (var k = 0; k < l; k++) {
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
- var colors = [];
205
- var degrees = [];
204
+ const colors = [];
205
+ const degrees = [];
206
206
 
207
- for (var i = 0; i < vertexCount; i++) {
207
+ for (let i = 0; i < vertexCount; i++) {
208
208
 
209
209
  colors[i] = 0;
210
210
  degrees[i] = 0;
211
211
 
212
- for (var j = 0; j < vertexCount; j++) {
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
- var x, y;
224
- var result;
225
- var colorNumber = 0;
226
- var VerticesInCommon = 0;
227
- var unprocessed = vertexCount;
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,6 +1,6 @@
1
1
  /**
2
- * @template Node
3
2
  * Build a Graphviz DOT representation of the graph
3
+ * @template Node
4
4
  * @param {Graph<Node>} graph
5
5
  * @param {function(Node):string} nodeToDot
6
6
  * @returns {string}
@@ -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":"AAQA;;;;;;GAMG;AACH,0FAFa,MAAM,CAgElB"}
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
- function defaultNodeToDot(node){
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
- graph,
18
- nodeToDot=defaultNodeToDot
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 graph_adjacency_matrix(graph, result, node_indices) {
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 graph_laplacian_matrix<T>(graph: Graph<T>, result: SquareMatrix, node_indices: Map<T, number>): void;
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=graph_laplacian_matrix.d.ts.map
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 { graph_adjacency_matrix } from "./graph_adjacency_matrix.js";
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 graph_laplacian_matrix(graph, result, node_indices) {
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
- graph_degree_matrix(graph, degree, node_indices);
19
- graph_adjacency_matrix(graph, adjacency, node_indices);
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":"AAyHA;;;;;;;;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
+ {"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 = build_distance_matrix(graph, node_array, clusters_seeds, node_index_map);
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 {number[]}
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 coarsen_graph<T>(graph: Graph<MultiNode<T>>, max_node_limit: number): void;
9
- //# sourceMappingURL=coarsen_graph.d.ts.map
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 coarsen_graph(graph, max_node_limit) {
12
+ export function mn_graph_coarsen(graph, max_node_limit) {
13
13
 
14
14
  /**
15
15
  *
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mn_graph_coarsen.spec.d.ts.map
@@ -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 { Graph } from "./v2/Graph.js";
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
- coarsen_graph(graph, 2);
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
- coarsen_graph(g, 100);
40
+ mn_graph_coarsen(g, 100);
41
41
 
42
42
  expect(g.getNodeCount()).toBe(1);
43
43
  });
@@ -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
@@ -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;;;;;;;GAOG;AACH,+HAJW,MAAM,2BAEJ,OAAO,CAoEnB"}
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(graph, edge, source_limit, heap) {
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":"AAOA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
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) * Math.pow(1.0 - u, 5.0);
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 D_GGX(NoH: number, roughness: number): number;
9
- //# sourceMappingURL=D_GGX.d.ts.map
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 D_GGX(NoH, roughness) {
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);