@woosh/meep-engine 2.109.1 → 2.109.3

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 (276) hide show
  1. package/build/meep.cjs +126 -186
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +126 -186
  4. package/package.json +1 -1
  5. package/src/core/binary/ctz32.d.ts.map +1 -1
  6. package/src/core/binary/ctz32.js +12 -11
  7. package/src/core/binary/reinterpret_int32_as_float32.d.ts +7 -0
  8. package/src/core/binary/reinterpret_int32_as_float32.d.ts.map +1 -0
  9. package/src/core/binary/reinterpret_int32_as_float32.js +14 -0
  10. package/src/core/binary/reverse_bits_uint32.d.ts +8 -0
  11. package/src/core/binary/reverse_bits_uint32.d.ts.map +1 -0
  12. package/src/core/binary/reverse_bits_uint32.js +17 -0
  13. package/src/core/binary/reverse_bits_uint32.spec.d.ts +2 -0
  14. package/src/core/binary/reverse_bits_uint32.spec.d.ts.map +1 -0
  15. package/src/core/binary/reverse_bits_uint32.spec.js +18 -0
  16. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  17. package/src/core/bvh2/bvh3/BVH.js +13 -18
  18. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.d.ts.map +1 -1
  19. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +3 -1
  20. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  21. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +6 -7
  22. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  23. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +4 -0
  24. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts +16 -0
  25. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts.map +1 -0
  26. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.js +130 -0
  27. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.d.ts +18 -0
  28. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.d.ts.map +1 -0
  29. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.js +94 -0
  30. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.d.ts +18 -0
  31. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.d.ts.map +1 -0
  32. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.js +100 -0
  33. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts +2 -0
  34. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts.map +1 -0
  35. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.js +1 -0
  36. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts +9 -0
  37. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts.map +1 -0
  38. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.js +31 -0
  39. package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts +9 -0
  40. package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts.map +1 -0
  41. package/src/core/collection/array/array_quick_sort_by_lookup_map.js +79 -0
  42. package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts +8 -0
  43. package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts.map +1 -0
  44. package/src/core/collection/array/{array_quick_sort_by_lookup.js → array_quick_sort_by_lookup_uint.js} +1 -1
  45. package/src/core/collection/array/array_shuffle.js +1 -1
  46. package/src/core/collection/array/array_swap_one.d.ts.map +1 -1
  47. package/src/core/collection/array/array_swap_one.js +6 -0
  48. package/src/core/collection/map/HashMap.js +2 -2
  49. package/src/core/events/signal/Signal.d.ts.map +1 -1
  50. package/src/core/events/signal/Signal.js +10 -10
  51. package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
  52. package/src/core/geom/2d/compute_triangle_area_2d.js +5 -3
  53. package/src/core/geom/3d/Ray3.d.ts +6 -0
  54. package/src/core/geom/3d/Ray3.d.ts.map +1 -1
  55. package/src/core/geom/3d/Ray3.js +24 -0
  56. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts +16 -0
  57. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts.map +1 -0
  58. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.js +29 -0
  59. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts +2 -2
  60. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts.map +1 -1
  61. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.js +6 -6
  62. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts +21 -0
  63. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts.map +1 -0
  64. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js +67 -0
  65. package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts +2 -2
  66. package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts.map +1 -1
  67. package/src/core/geom/3d/eulerAnglesFromMatrix.js +28 -25
  68. package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts +2 -2
  69. package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts.map +1 -1
  70. package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +1 -1
  71. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -2
  72. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
  73. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +1 -1
  74. package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts +11 -0
  75. package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts.map +1 -0
  76. package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js +61 -0
  77. package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +2 -2
  78. package/src/core/geom/3d/sphere/sphere_intersects_ray.js +1 -1
  79. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -1
  80. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.js +24 -188
  81. package/src/core/geom/3d/tetrahedra/triangle/prototype.js +1 -1
  82. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts +11 -0
  83. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts.map +1 -0
  84. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.js +42 -0
  85. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +2 -2
  86. package/src/core/geom/3d/topology/tm_face_area.js +2 -2
  87. package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.d.ts → compute_triangle_area_3d.d.ts} +2 -2
  88. package/src/core/geom/3d/triangle/compute_triangle_area_3d.d.ts.map +1 -0
  89. package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.js → compute_triangle_area_3d.js} +2 -4
  90. package/src/core/geom/Quaternion.d.ts.map +1 -1
  91. package/src/core/geom/Quaternion.js +13 -102
  92. package/src/core/geom/Quaternion.spec.js +2 -2
  93. package/src/core/geom/Vector1.d.ts.map +1 -1
  94. package/src/core/geom/Vector1.js +14 -6
  95. package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts +14 -0
  96. package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts.map +1 -0
  97. package/src/core/geom/vec3/{v3_shift_along_direction.js → v3_array_displace_in_direction.js} +1 -1
  98. package/src/core/geom/vec3/v3_displace_in_direction.d.ts +7 -7
  99. package/src/core/geom/vec3/v3_displace_in_direction.d.ts.map +1 -1
  100. package/src/core/geom/vec3/v3_displace_in_direction.js +20 -17
  101. package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts +2 -0
  102. package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts.map +1 -0
  103. package/src/core/geom/vec3/v3_displace_in_direction.spec.js +80 -0
  104. package/src/core/geom/vec4/v4_length.d.ts +10 -0
  105. package/src/core/geom/vec4/v4_length.d.ts.map +1 -0
  106. package/src/core/geom/vec4/v4_length.js +13 -0
  107. package/src/core/geom/vec4/v4_length_sqr.js +2 -1
  108. package/src/core/graph/eigen/matrix_eigenvalues_in_place.spec.js +31 -1
  109. package/src/core/math/FLT_EPSILON_64.d.ts +6 -0
  110. package/src/core/math/FLT_EPSILON_64.d.ts.map +1 -0
  111. package/src/core/math/FLT_EPSILON_64.js +5 -0
  112. package/src/core/math/gaussian.d.ts +2 -2
  113. package/src/core/math/gaussian.js +2 -2
  114. package/src/core/math/linalg/README.md +1 -0
  115. package/src/core/math/linalg/lu_factor_linear_system.d.ts +13 -0
  116. package/src/core/math/linalg/lu_factor_linear_system.d.ts.map +1 -0
  117. package/src/core/math/linalg/lu_factor_linear_system.js +112 -0
  118. package/src/core/math/linalg/lu_solve_linear_system.d.ts +14 -0
  119. package/src/core/math/linalg/lu_solve_linear_system.d.ts.map +1 -0
  120. package/src/core/math/linalg/lu_solve_linear_system.js +51 -0
  121. package/src/core/math/linalg/solve_linear_system.d.ts +14 -0
  122. package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -0
  123. package/src/core/math/linalg/solve_linear_system.js +52 -0
  124. package/src/core/math/linalg/solve_linear_system.spec.d.ts +2 -0
  125. package/src/core/math/linalg/solve_linear_system.spec.d.ts.map +1 -0
  126. package/src/core/math/linalg/solve_linear_system.spec.js +70 -0
  127. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts +10 -0
  128. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts.map +1 -0
  129. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.js +91 -0
  130. package/src/core/math/max4.d.ts +10 -0
  131. package/src/core/math/max4.d.ts.map +1 -0
  132. package/src/core/math/max4.js +24 -0
  133. package/src/core/math/min4.d.ts +10 -0
  134. package/src/core/math/min4.d.ts.map +1 -0
  135. package/src/core/math/min4.js +23 -0
  136. package/src/core/math/solveQuadratic.d.ts.map +1 -1
  137. package/src/core/math/solveQuadratic.js +2 -0
  138. package/src/core/math/statistics/gaussian_amplitude.d.ts +8 -0
  139. package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -0
  140. package/src/core/math/statistics/gaussian_amplitude.js +13 -0
  141. package/src/core/math/statistics/halton_sequence.js +3 -3
  142. package/src/core/math/statistics/halton_sequence.spec.js +18 -0
  143. package/src/core/math/statistics/hammersley_sequence.d.ts +9 -0
  144. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -0
  145. package/src/core/math/statistics/hammersley_sequence.js +25 -0
  146. package/src/core/math/statistics/hammersley_sequence_2d.d.ts +9 -0
  147. package/src/core/math/statistics/hammersley_sequence_2d.d.ts.map +1 -0
  148. package/src/core/math/statistics/hammersley_sequence_2d.js +17 -0
  149. package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts +8 -0
  150. package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts.map +1 -0
  151. package/src/core/math/statistics/radical_inverse_VdC_base_2.js +15 -0
  152. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts +2 -0
  153. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts.map +1 -0
  154. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.js +9 -0
  155. package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
  156. package/src/core/model/node-graph/node/NodeInstance.js +26 -12
  157. package/src/core/model/node-graph/node/NodeInstance.spec.d.ts +2 -0
  158. package/src/core/model/node-graph/node/NodeInstance.spec.d.ts.map +1 -0
  159. package/src/core/model/node-graph/node/NodeInstance.spec.js +82 -0
  160. package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts.map +1 -1
  161. package/src/core/model/node-graph/node/NodeInstancePortReference.js +9 -0
  162. package/src/core/model/node-graph/node/NodeInstancePortReference.spec.js +20 -0
  163. package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
  164. package/src/core/model/node-graph/node/Port.js +5 -12
  165. package/src/core/model/node-graph/node/PortDirection.d.ts.map +1 -1
  166. package/src/core/model/node-graph/node/PortDirection.js +7 -1
  167. package/src/engine/asset/CORS/CrossOriginConfig.d.ts.map +1 -1
  168. package/src/engine/asset/CORS/CrossOriginConfig.js +6 -4
  169. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.d.ts.map +1 -1
  170. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +9 -5
  171. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +2 -2
  172. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts.map +1 -1
  173. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +33 -3
  174. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +12 -9
  175. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts +6 -0
  176. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts.map +1 -0
  177. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.js +18 -0
  178. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts +6 -0
  179. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts.map +1 -0
  180. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.js +266 -0
  181. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts +7 -0
  182. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts.map +1 -0
  183. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.js +19 -0
  184. package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -9
  185. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
  186. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +0 -2
  187. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +4 -27
  188. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  189. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +36 -158
  190. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +13 -0
  191. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -0
  192. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +63 -0
  193. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +1 -0
  194. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  195. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +25 -1
  196. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
  197. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +4 -29
  198. package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.d.ts → serialization/LightProbeVolumeSerializationAdapter.d.ts} +2 -2
  199. package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
  200. package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.js → serialization/LightProbeVolumeSerializationAdapter.js} +2 -2
  201. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts +13 -0
  202. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +1 -0
  203. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.js +71 -0
  204. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts +2 -0
  205. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts.map +1 -0
  206. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.js +38 -0
  207. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +1 -7
  208. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
  209. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +34 -148
  210. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +13 -9
  211. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
  212. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +75 -55
  213. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +23 -5
  214. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
  215. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +201 -72
  216. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
  217. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts +15 -0
  218. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
  219. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.js +46 -0
  220. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts +14 -0
  221. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
  222. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.js +43 -0
  223. package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts.map +1 -0
  224. package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.js → geometry/compute_triangle_group_aabb3.js} +2 -2
  225. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts +12 -0
  226. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts.map +1 -0
  227. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.js +72 -0
  228. package/src/engine/graphics/sh3/path_tracer/geometry/sample_triangle_attribute.d.ts.map +1 -0
  229. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts +13 -0
  230. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts.map +1 -0
  231. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.js +48 -0
  232. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +1 -0
  233. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -1
  234. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +4 -0
  235. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +1 -0
  236. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -1
  237. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +8 -5
  238. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +27 -21
  239. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts +2 -2
  240. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts.map +1 -1
  241. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +1 -1
  242. package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -0
  243. package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.js → sampling/getBiasedNormalSample.js} +1 -1
  244. package/src/engine/graphics/sh3/path_tracer/sampling/random_in_hemisphere.d.ts.map +1 -0
  245. package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.js → sampling/random_in_hemisphere.js} +1 -1
  246. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts +12 -0
  247. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
  248. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.js +46 -0
  249. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
  250. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts +7 -0
  251. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts.map +1 -0
  252. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.js +69 -0
  253. package/src/engine/graphics/sh3/prototypeSH3Probe.js +29 -7
  254. package/src/engine/graphics/texture/formatToChannelCount.d.ts.map +1 -1
  255. package/src/engine/graphics/texture/formatToChannelCount.js +14 -1
  256. package/src/engine/graphics/three/three_object_replace_materials.d.ts +7 -0
  257. package/src/engine/graphics/three/three_object_replace_materials.d.ts.map +1 -0
  258. package/src/engine/graphics/three/three_object_replace_materials.js +13 -0
  259. package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +0 -8
  260. package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +0 -1
  261. package/src/core/geom/3d/triangle/computeTriangleSurfaceArea.d.ts.map +0 -1
  262. package/src/core/geom/vec3/v3_shift_along_direction.d.ts +0 -14
  263. package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +0 -1
  264. package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts +0 -2
  265. package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts.map +0 -1
  266. package/src/engine/graphics/filter/FlipArrayViaCanvas.js +0 -13
  267. package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +0 -1
  268. package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +0 -1
  269. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +0 -1
  270. package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +0 -1
  271. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +0 -1
  272. /package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.d.ts → geometry/compute_triangle_group_aabb3.d.ts} +0 -0
  273. /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.d.ts → geometry/sample_triangle_attribute.d.ts} +0 -0
  274. /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.js → geometry/sample_triangle_attribute.js} +0 -0
  275. /package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.d.ts → sampling/getBiasedNormalSample.d.ts} +0 -0
  276. /package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.d.ts → sampling/random_in_hemisphere.d.ts} +0 -0
@@ -9,6 +9,7 @@ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
9
9
  import { quat_decode_from_uint32 } from "./3d/quaternion/quat_decode_from_uint32.js";
10
10
  import { quat_encode_to_uint32 } from "./3d/quaternion/quat_encode_to_uint32.js";
11
11
  import { v3_dot } from "./vec3/v3_dot.js";
12
+ import { v4_length } from "./vec4/v4_length.js";
12
13
  import Vector3 from "./Vector3.js";
13
14
 
14
15
 
@@ -451,7 +452,7 @@ class Quaternion {
451
452
  const z = this.z;
452
453
  const w = this.w;
453
454
 
454
- return Math.sqrt(x * x + y * y + z * z + w * w);
455
+ return v4_length(x, y, z, w);
455
456
  }
456
457
 
457
458
  /**
@@ -463,48 +464,20 @@ class Quaternion {
463
464
  Quaternion.rotateTowards(this, this, other, max_delta);
464
465
  }
465
466
 
466
- /**
467
- *
468
- * @param {Vector3} direction
469
- * @param {Vector3} [up]
470
- * @param {Vector3} [forward]
471
- */
472
- alignToDirection(direction, up = Vector3.up, forward = Vector3.forward) {
473
-
474
- const dot = up.dot(direction);
475
-
476
-
477
- if (Math.abs(dot + 1) < 0.000001) {
478
- // vector a and b point exactly in the opposite direction,
479
- // so it is a 180 degrees turn around the up-axis
480
- this.set(forward.x, forward.y, forward.z, Math.PI);
481
- } else if (Math.abs(dot - 1) < 0.000001) {
482
- // vector a and b point exactly in the same direction
483
- // so we return the identity quaternion
484
- this.set(0, 0, 0, 1);
485
- }
486
-
487
- const angle = Math.acos(dot);
488
-
489
- axis.crossVectors(up, direction);
490
- axis.normalize();
491
-
492
- this.fromAxisAngle(axis, angle);
493
- }
494
-
495
467
  /**
496
468
  *
497
469
  * @param {Vector3} source
498
470
  * @param {Vector3} target
471
+ * @param {Vector3} [up]
499
472
  */
500
- lookAt(source, target) {
473
+ lookAt(source, target, up = Vector3.up) {
501
474
  const forward = new Vector3();
502
475
 
503
476
  forward.subVectors(target, source);
504
477
 
505
478
  forward.normalize();
506
479
 
507
- this.alignToDirection(forward);
480
+ this.lookRotation(forward, up);
508
481
  }
509
482
 
510
483
  /**
@@ -887,22 +860,23 @@ class Quaternion {
887
860
  const qW_1 = qW + l0;
888
861
 
889
862
  //normalize result
890
- const l1 = Math.sqrt(p0 + qW_1 * qW_1);
863
+ const l1 = 1 / Math.sqrt(p0 + qW_1 * qW_1);
891
864
 
892
- const x = qX / l1;
893
- const y = qY / l1;
894
- const z = qZ / l1;
895
- const w = qW / l1;
865
+ const x = qX * l1;
866
+ const y = qY * l1;
867
+ const z = qZ * l1;
868
+ const w = qW * l1;
896
869
 
897
870
  this.set(x, y, z, w);
898
871
  }
899
872
 
900
873
  /**
874
+ * NOTE: Vectors need to be normalized
901
875
  * Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
902
876
  * @param {Vector3} from
903
877
  * @param {Vector3} to
904
878
  */
905
- fromUnitVectors2(from, to) {
879
+ fromUnitVectors(from, to) {
906
880
  assert.ok(from.isNormalized(), `from vector is not normalized, length = ${from.length()}`);
907
881
  assert.ok(to.isNormalized(), `to vector is not normalized, length = ${to.length()}`);
908
882
 
@@ -923,7 +897,7 @@ class Quaternion {
923
897
 
924
898
  const uv_dot = v3_dot(ax, ay, az, bx, by, bz);
925
899
 
926
- if (uv_dot === -1) {
900
+ if (uv_dot < -0.9999999) {
927
901
  //to vector is opposite, produce a reversal quaternion
928
902
 
929
903
  tempvec3.crossVectors(Vector3.left, from);
@@ -967,51 +941,6 @@ class Quaternion {
967
941
  );
968
942
  }
969
943
 
970
- /**
971
- * Input vectors must be normalized
972
- * @param {Vector3} from
973
- * @param {Vector3} to
974
- */
975
- fromUnitVectors(from, to) {
976
- assert.ok(from.isNormalized(), `from vector is not normalized, length = ${from.length()}`);
977
- assert.ok(to.isNormalized(), `to vector is not normalized, length = ${to.length()}`);
978
-
979
- const dot = from.dot(to);
980
-
981
- let x, y, z, w;
982
-
983
- if (dot < -0.9999999) {
984
- const tempvec3 = new Vector3();
985
-
986
- tempvec3.crossVectors(Vector3.left, from);
987
-
988
- if (tempvec3.lengthSqr() < 0.00001) {
989
- tempvec3.crossVectors(Vector3.up, from);
990
- }
991
-
992
- tempvec3.normalize();
993
-
994
- this.fromAxisAngle(tempvec3, Math.PI);
995
- } else if (dot > 0.9999999) {
996
- x = 0;
997
- y = 0;
998
- z = 0;
999
- w = 1;
1000
-
1001
- this.set(x, y, z, w);
1002
- } else {
1003
- //cross product from x to
1004
-
1005
- x = from.y * to.z - from.z * to.y;
1006
- y = from.z * to.x - from.x * to.z;
1007
- z = from.x * to.y - from.y * to.x;
1008
- w = 1 + dot;
1009
-
1010
- this.set(x, y, z, w);
1011
- this.normalize();
1012
- }
1013
- }
1014
-
1015
944
  /**
1016
945
  * @deprecated
1017
946
  * @param {Matrix4} m
@@ -1216,17 +1145,6 @@ class Quaternion {
1216
1145
  this.slerpQuaternions(this, other, t);
1217
1146
  }
1218
1147
 
1219
- /**
1220
- * @see https://github.com/gareth-cross/quat/blob/master/include/quaternion.hpp
1221
- * TODO implement
1222
- * @param {Quaternion} a
1223
- * @param {Quaternion} b
1224
- * @param {number} t
1225
- */
1226
- quaternionsInterpolateRungeKutta4(a, b, t) {
1227
- throw new Error('Not Implemented');
1228
- }
1229
-
1230
1148
  /**
1231
1149
  *
1232
1150
  * @param {function} handler
@@ -1557,13 +1475,6 @@ Quaternion.prototype.toArray = Quaternion.prototype.writeToArray;
1557
1475
  Quaternion.identity = Object.freeze(new Quaternion(0, 0, 0, 1));
1558
1476
 
1559
1477
 
1560
- /**
1561
- *
1562
- * @type {Vector3}
1563
- */
1564
- const axis = new Vector3();
1565
-
1566
-
1567
1478
  const tempvec3 = new Vector3();
1568
1479
 
1569
1480
  export default Quaternion;
@@ -70,14 +70,14 @@ test('multiply quaternions', () => {
70
70
  });
71
71
  });
72
72
 
73
- test('fromUnitVectors2', () => {
73
+ test('fromUnitVectors', () => {
74
74
  const q = new Quaternion();
75
75
 
76
76
  const v = new Vector3();
77
77
 
78
78
  function check(v0, v1) {
79
79
 
80
- q.fromUnitVectors2(v0, v1);
80
+ q.fromUnitVectors(v0, v1);
81
81
 
82
82
  v.copy(v0);
83
83
 
@@ -1 +1 @@
1
- {"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IA2PI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,GACN,MAAM,CAIjB;IAlQD;;;;;;OAMG;IACH,gBALW,MAAM,EAchB;IAHG,UAAU;IAEV,0DAA6B;IAWjC;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,OAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED,kBAEC;IAED,kBAEC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,WAFW,OAAO,8BAAwB,WAIzC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,WAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,OAAO,8BAAwB,QAIzC;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;OAEG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,4BAGC;IAED,iBAEC;IAED,yBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED,oBAEC;IAED;;;OAGG;IACH,2CAEC;IAED;;;OAGG;IACH,6CAIC;IAgBD,mBAEC;IAND,gBAEC;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAYS,OAAO;aAMP,OAAO;;mBAzSE,4BAA4B"}
1
+ {"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IAmQI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,GACN,MAAM,CAIjB;IA1QD;;;;;;OAMG;IACH,gBALW,MAAM,EAchB;IAHG,UAAU;IAEV,0DAA6B;IAWjC;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,OAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED,kBAEC;IAED,kBAEC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,WAFW,OAAO,8BAAwB,WAIzC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,WAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,eAEC;IAED;;;OAGG;IACH,YAFW,OAAO,8BAAwB,QAIzC;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;OAEG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,4BAGC;IAED,iBAEC;IAED,yBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED,oBAEC;IAED;;;OAGG;IACH,2CAEC;IAED;;;OAGG;IACH,6CAIC;IAgBD,mBAEC;IAND,gBAEC;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAYS,OAAO;aAMP,OAAO;;mBAjTE,4BAA4B"}
@@ -20,7 +20,7 @@ class Vector1 extends Number {
20
20
  constructor(x = 0) {
21
21
  super();
22
22
 
23
- assert.isNumber( x, 'x');
23
+ assert.isNumber(x, 'x');
24
24
  assert.notNaN(x, 'x');
25
25
 
26
26
  this.x = x;
@@ -67,7 +67,7 @@ class Vector1 extends Number {
67
67
  * @returns {Vector1}
68
68
  */
69
69
  set(x) {
70
- assert.isNumber( x,'x');
70
+ assert.isNumber(x, 'x');
71
71
  assert.notNaN(x, 'x');
72
72
 
73
73
  const oldValue = this.x;
@@ -87,7 +87,7 @@ class Vector1 extends Number {
87
87
  * @param {number} x
88
88
  */
89
89
  setSilent(x) {
90
- assert.isNumber( x,'x');
90
+ assert.isNumber(x, 'x');
91
91
  assert.notNaN(x, 'x');
92
92
 
93
93
  this.x = x;
@@ -171,6 +171,14 @@ class Vector1 extends Number {
171
171
  return this.set(clamp(this.x, low, high));
172
172
  }
173
173
 
174
+ /**
175
+ * Negate sign of the value, if value is 7, it will become -7 and vice versa
176
+ * Zero is unaffected
177
+ */
178
+ negate() {
179
+ this.set(-this.x);
180
+ }
181
+
174
182
  /**
175
183
  *
176
184
  * @param {Vector1|Vector2|Vector3|Vector4} other
@@ -225,7 +233,7 @@ class Vector1 extends Number {
225
233
  * @param {number[]} array
226
234
  * @param {number} offset
227
235
  */
228
- readFromArray(array, offset=0) {
236
+ readFromArray(array, offset = 0) {
229
237
  this.set(array[offset]);
230
238
  }
231
239
 
@@ -234,11 +242,11 @@ class Vector1 extends Number {
234
242
  * @param {number[]} array
235
243
  * @param {number} offset
236
244
  */
237
- writeToArray(array, offset=0) {
245
+ writeToArray(array, offset = 0) {
238
246
  array[offset] = this.x;
239
247
  }
240
248
 
241
- asArray(){
249
+ asArray() {
242
250
  return [this.x];
243
251
  }
244
252
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float32Array} output
4
+ * @param {number} output_offset
5
+ * @param {number} origin_x
6
+ * @param {number} origin_y
7
+ * @param {number} origin_z
8
+ * @param {number} direction_x
9
+ * @param {number} direction_y
10
+ * @param {number} direction_z
11
+ * @param {number} distance
12
+ */
13
+ export function v3_array_displace_in_direction(output: number[] | Float32Array, output_offset: number, origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, distance: number): void;
14
+ //# sourceMappingURL=v3_array_displace_in_direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_array_displace_in_direction.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_array_displace_in_direction.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,uDAVW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,YACN,MAAM,QAYhB"}
@@ -10,7 +10,7 @@
10
10
  * @param {number} direction_z
11
11
  * @param {number} distance
12
12
  */
13
- export function v3_shift_along_direction(
13
+ export function v3_array_displace_in_direction(
14
14
  output, output_offset,
15
15
  origin_x, origin_y, origin_z,
16
16
  direction_x, direction_y, direction_z,
@@ -2,13 +2,13 @@
2
2
  *
3
3
  * @param {Vector3} result
4
4
  * @param {number} distance
5
- * @param {number} sourceX
6
- * @param {number} sourceY
7
- * @param {number} sourceZ
8
- * @param {number} directionX
9
- * @param {number} directionY
10
- * @param {number} directionZ
5
+ * @param {number} origin_x
6
+ * @param {number} source_y
7
+ * @param {number} source_z
8
+ * @param {number} direction_x
9
+ * @param {number} direction_y
10
+ * @param {number} direction_z
11
11
  * @returns {boolean} true if displaced successfully, false if direction had 0 magnitude
12
12
  */
13
- export function v3_displace_in_direction(result: Vector3, distance: number, sourceX: number, sourceY: number, sourceZ: number, directionX: number, directionY: number, directionZ: number): boolean;
13
+ export function v3_displace_in_direction(result: Vector3, distance: number, origin_x: number, source_y: number, source_z: number, direction_x: number, direction_y: number, direction_z: number): boolean;
14
14
  //# sourceMappingURL=v3_displace_in_direction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v3_displace_in_direction.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_displace_in_direction.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,oEATW,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,OAAO,CAgCnB"}
1
+ {"version":3,"file":"v3_displace_in_direction.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_displace_in_direction.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,oEATW,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,OAAO,CAmCnB"}
@@ -2,40 +2,43 @@
2
2
  *
3
3
  * @param {Vector3} result
4
4
  * @param {number} distance
5
- * @param {number} sourceX
6
- * @param {number} sourceY
7
- * @param {number} sourceZ
8
- * @param {number} directionX
9
- * @param {number} directionY
10
- * @param {number} directionZ
5
+ * @param {number} origin_x
6
+ * @param {number} source_y
7
+ * @param {number} source_z
8
+ * @param {number} direction_x
9
+ * @param {number} direction_y
10
+ * @param {number} direction_z
11
11
  * @returns {boolean} true if displaced successfully, false if direction had 0 magnitude
12
12
  */
13
13
  export function v3_displace_in_direction(
14
14
  result,
15
15
  distance,
16
- sourceX, sourceY, sourceZ,
17
- directionX, directionY, directionZ
16
+ origin_x, source_y, source_z,
17
+ direction_x, direction_y, direction_z
18
18
  ) {
19
+
19
20
  if (distance === 0) {
20
- result.set(sourceX, sourceY, sourceZ);
21
+ result.set(origin_x, source_y, source_z);
21
22
  return true;
22
23
  }
23
24
 
24
- //scale direction to have length equal to distance
25
+ // scale direction to have length equal to distance
25
26
 
26
- const directionLength = Math.sqrt(directionX * directionX + directionY * directionY + directionZ * directionZ);
27
+ const direction_length_sqr = direction_x * direction_x + direction_y * direction_y + direction_z * direction_z;
27
28
 
28
- if(directionLength === 0){
29
+ if (direction_length_sqr === 0) {
29
30
  // direction vector is zero length, avoid division by zero, clamp to source instead
30
- result.set(sourceX, sourceY, sourceZ);
31
+ result.set(origin_x, source_y, source_z);
31
32
  return false;
32
33
  }
33
34
 
34
- const m = distance / directionLength;
35
+ const direction_length = Math.sqrt(direction_length_sqr);
35
36
 
36
- const x = sourceX + directionX * m;
37
- const y = sourceY + directionY * m;
38
- const z = sourceZ + directionZ * m;
37
+ const m = distance / direction_length;
38
+
39
+ const x = origin_x + direction_x * m;
40
+ const y = source_y + direction_y * m;
41
+ const z = source_z + direction_z * m;
39
42
 
40
43
  result.set(x, y, z);
41
44
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=v3_displace_in_direction.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_displace_in_direction.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_displace_in_direction.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ import Vector3 from "../Vector3.js";
2
+ import { v3_displace_in_direction } from "./v3_displace_in_direction.js";
3
+
4
+ test("zero distance", () => {
5
+
6
+ const r = new Vector3();
7
+
8
+ expect(v3_displace_in_direction(
9
+ r, 0,
10
+ 0, 0, 0,
11
+ 0, 0, 1
12
+ )).toBe(true);
13
+
14
+ });
15
+
16
+ test("direction magnitude is 0", () => {
17
+
18
+ const r = new Vector3();
19
+
20
+ expect(v3_displace_in_direction(
21
+ r, 1,
22
+ 0, 0, 0,
23
+ 0, 0, 0
24
+ )).toBe(false);
25
+
26
+ });
27
+
28
+ test("cardinal directions", () => {
29
+
30
+ const r = new Vector3();
31
+
32
+ expect(v3_displace_in_direction(
33
+ r, -3,
34
+ 1, 2, 3,
35
+ 0, 0, 1
36
+ )).toBe(true);
37
+
38
+ expect(r.asArray()).toEqual([1, 2, 0]);
39
+
40
+ expect(v3_displace_in_direction(
41
+ r, -3,
42
+ 1, 2, 3,
43
+ 0, 0, -1
44
+ )).toBe(true);
45
+
46
+ expect(r.asArray()).toEqual([1, 2, 6]);
47
+
48
+ expect(v3_displace_in_direction(
49
+ r, -3,
50
+ 1, 2, 3,
51
+ 0, 1, 0
52
+ )).toBe(true);
53
+
54
+ expect(r.asArray()).toEqual([1, -1, 3]);
55
+
56
+ expect(v3_displace_in_direction(
57
+ r, -3,
58
+ 1, 2, 3,
59
+ 0, -1, 0
60
+ )).toBe(true);
61
+
62
+ expect(r.asArray()).toEqual([1, 5, 3]);
63
+
64
+ expect(v3_displace_in_direction(
65
+ r, -3,
66
+ 1, 2, 3,
67
+ 1, 0, 0
68
+ )).toBe(true);
69
+
70
+ expect(r.asArray()).toEqual([-2, 2, 3]);
71
+
72
+ expect(v3_displace_in_direction(
73
+ r, -3,
74
+ 1, 2, 3,
75
+ -1, 0, 0
76
+ )).toBe(true);
77
+
78
+ expect(r.asArray()).toEqual([4, 2, 3]);
79
+
80
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * @param {number} x
4
+ * @param {number} y
5
+ * @param {number} z
6
+ * @param {number} w
7
+ * @returns {number}
8
+ */
9
+ export function v4_length(x: number, y: number, z: number, w: number): number;
10
+ //# sourceMappingURL=v4_length.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v4_length.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec4/v4_length.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,6BANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB"}
@@ -0,0 +1,13 @@
1
+ import { v4_length_sqr } from "./v4_length_sqr.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number} x
6
+ * @param {number} y
7
+ * @param {number} z
8
+ * @param {number} w
9
+ * @returns {number}
10
+ */
11
+ export function v4_length(x, y, z, w) {
12
+ return Math.sqrt(v4_length_sqr(x, y, z, w));
13
+ }
@@ -8,4 +8,5 @@
8
8
  */
9
9
  export function v4_length_sqr(x, y, z, w) {
10
10
  return x * x + y * y + z * z + w * w;
11
- }
11
+ }
12
+
@@ -10,7 +10,22 @@ function roughly_equal_array_vectors(actual, expected) {
10
10
  }
11
11
  }
12
12
 
13
- test("sample", () => {
13
+ test("2x2 sample A", () => {
14
+
15
+
16
+ const t = new SquareMatrix(2, BinaryDataType.Float32);
17
+ t.fromArray([
18
+ 1,-2,
19
+ 5,-7
20
+ ]);
21
+
22
+ const eigen = matrix_eigenvalues_in_place(t);
23
+
24
+
25
+ roughly_equal_array_vectors(eigen, [-5.44949, -0.55051]);
26
+ });
27
+
28
+ test("3x3 sample A", () => {
14
29
 
15
30
 
16
31
  const t = new SquareMatrix(3, BinaryDataType.Float32);
@@ -25,3 +40,18 @@ test("sample", () => {
25
40
 
26
41
  roughly_equal_array_vectors(eigen, [9.62192181, -9.12030391, 3.4983821]);
27
42
  });
43
+ test("3x3 sample B", () => {
44
+
45
+
46
+ const t = new SquareMatrix(3, BinaryDataType.Float32);
47
+ t.fromArray([
48
+ 1, 2, 3,
49
+ 4, 5, 6,
50
+ 7, 8, 9
51
+ ]);
52
+
53
+ const eigen = matrix_eigenvalues_in_place(t);
54
+
55
+
56
+ roughly_equal_array_vectors(eigen, [16.1168, -1.11684, 0]);
57
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Machine epsilon, 2^(-53)
3
+ * @type {number}
4
+ */
5
+ export const FLT_EPSILON_64: number;
6
+ //# sourceMappingURL=FLT_EPSILON_64.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FLT_EPSILON_64.d.ts","sourceRoot":"","sources":["../../../../src/core/math/FLT_EPSILON_64.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,6BAFU,MAAM,CAEqC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Machine epsilon, 2^(-53)
3
+ * @type {number}
4
+ */
5
+ export const FLT_EPSILON_64 = 1.1102230246251565e-16;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
- * @param {number} sigma
4
- * @param {number} v
3
+ * @param {number} sigma distance from mean
4
+ * @param {number} v Variance
5
5
  * @returns {number}
6
6
  */
7
7
  export function gaussian(sigma: number, v: number): number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
- * @param {number} sigma
4
- * @param {number} v
3
+ * @param {number} sigma distance from mean
4
+ * @param {number} v Variance
5
5
  * @returns {number}
6
6
  */
7
7
  export function gaussian(sigma, v) {
@@ -0,0 +1 @@
1
+ Linear Argebra package
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Factor linear equations Ax = b using LU decomposition A = LU where L is
3
+ * lower triangular matrix and U is upper triangular matrix. Input is
4
+ * square matrix A, integer array of pivot indices index[0->n-1], and size
5
+ * of square matrix n. Output factorization LU is in matrix A. If error is
6
+ * found, method returns 0.
7
+ * @param {number[]} A Square matrix, will be modified
8
+ * @param {number[]|Uint32Array} index will be written to
9
+ * @param {number} size Size of the matrix ( 4x4 matrix has size 4 )
10
+ * @returns {boolean}
11
+ */
12
+ export function lu_factor_linear_system(A: number[], index: number[] | Uint32Array, size: number): boolean;
13
+ //# sourceMappingURL=lu_factor_linear_system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lu_factor_linear_system.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/linalg/lu_factor_linear_system.js"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AACH,2CALW,MAAM,EAAE,SACR,MAAM,EAAE,GAAC,WAAW,QACpB,MAAM,GACJ,OAAO,CA+FnB"}