@woosh/meep-engine 2.108.4 → 2.109.1

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 (185) hide show
  1. package/build/meep.cjs +101 -61
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +101 -61
  4. package/package.json +1 -1
  5. package/src/core/assert.d.ts +2 -2
  6. package/src/core/assert.d.ts.map +1 -1
  7. package/src/core/assert.js +1 -1
  8. package/src/core/binary/BitSet.d.ts +6 -0
  9. package/src/core/binary/BitSet.d.ts.map +1 -1
  10. package/src/core/binary/BitSet.js +14 -42
  11. package/src/core/binary/align_32.d.ts +7 -0
  12. package/src/core/binary/align_32.d.ts.map +1 -0
  13. package/src/core/binary/align_32.js +8 -0
  14. package/src/core/binary/align_32.spec.d.ts +2 -0
  15. package/src/core/binary/align_32.spec.d.ts.map +1 -0
  16. package/src/core/binary/align_32.spec.js +11 -0
  17. package/src/core/binary/align_4.js +2 -1
  18. package/src/core/binary/align_4.spec.d.ts +2 -0
  19. package/src/core/binary/align_4.spec.d.ts.map +1 -0
  20. package/src/core/binary/align_4.spec.js +20 -0
  21. package/src/core/binary/{de_interleave_bits_by_2.d.ts → de_interleave_2_bits.d.ts} +1 -1
  22. package/src/core/binary/de_interleave_2_bits.d.ts.map +1 -0
  23. package/src/core/binary/de_interleave_2_bits.spec.js +1 -1
  24. package/src/core/binary/hex2dec.spec.d.ts +2 -0
  25. package/src/core/binary/hex2dec.spec.d.ts.map +1 -0
  26. package/src/core/binary/hex2dec.spec.js +22 -0
  27. package/src/core/binary/lsb_32.d.ts +9 -0
  28. package/src/core/binary/lsb_32.d.ts.map +1 -0
  29. package/src/core/binary/lsb_32.js +12 -0
  30. package/src/core/binary/msb_32.d.ts +2 -0
  31. package/src/core/binary/msb_32.d.ts.map +1 -0
  32. package/src/core/binary/msb_32.js +20 -0
  33. package/src/core/binary/msb_lut_de_bruijn.d.ts +7 -0
  34. package/src/core/binary/msb_lut_de_bruijn.d.ts.map +1 -0
  35. package/src/core/binary/msb_lut_de_bruijn.js +9 -0
  36. package/src/core/binary/split_by_2.spec.d.ts +2 -0
  37. package/src/core/binary/split_by_2.spec.d.ts.map +1 -0
  38. package/src/core/binary/split_by_2.spec.js +22 -0
  39. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts +4 -1
  40. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  41. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +16 -7
  42. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +1 -1
  43. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
  44. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +12 -7
  45. package/src/core/geom/2d/circle/circle_circumference.d.ts +7 -0
  46. package/src/core/geom/2d/circle/circle_circumference.d.ts.map +1 -0
  47. package/src/core/geom/2d/circle/circle_circumference.js +12 -0
  48. package/src/core/geom/2d/compute_polygon_area_2d.d.ts.map +1 -1
  49. package/src/core/geom/2d/compute_polygon_area_2d.js +6 -4
  50. package/src/core/geom/2d/lt-grid/LooseTightGrid.js +1 -1
  51. package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
  52. package/src/core/geom/2d/triangle2d_get_barycentric.js +2 -2
  53. package/src/core/geom/3d/Ray3.d.ts +19 -0
  54. package/src/core/geom/3d/Ray3.d.ts.map +1 -0
  55. package/src/core/geom/3d/Ray3.js +27 -0
  56. package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts +10 -0
  57. package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts.map +1 -0
  58. package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +35 -0
  59. package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts +1 -0
  60. package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts.map +1 -0
  61. package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.js +0 -0
  62. package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts +9 -0
  63. package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts.map +1 -0
  64. package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js +26 -0
  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 +2 -4
  67. package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +8 -0
  68. package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts.map +1 -0
  69. package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +94 -0
  70. package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +8 -0
  71. package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +1 -0
  72. package/src/core/geom/3d/sphere/harmonics/{sh3_rotate.js → sh3_rotate_filament.js} +5 -2
  73. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts +12 -0
  74. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts.map +1 -0
  75. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js +40 -0
  76. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts +2 -0
  77. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts.map +1 -0
  78. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js +27 -0
  79. package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts +3 -3
  80. package/src/core/geom/3d/sphere/harmonics/sh_compute_K.js +3 -3
  81. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -1
  82. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +29 -14
  83. package/src/core/geom/Quaternion.js +1 -1
  84. package/src/core/geom/vec/vector_copy.d.ts +10 -0
  85. package/src/core/geom/vec/vector_copy.d.ts.map +1 -0
  86. package/src/core/geom/vec/vector_copy.js +13 -0
  87. package/src/core/{math/vector_nd_dot.d.ts → geom/vec/vector_dot.d.ts} +2 -2
  88. package/src/core/geom/vec/vector_dot.d.ts.map +1 -0
  89. package/src/core/{math/vector_nd_dot.js → geom/vec/vector_dot.js} +1 -1
  90. package/src/core/{math/vector_nd_normalize.d.ts → geom/vec/vector_normalize.d.ts} +2 -2
  91. package/src/core/geom/vec/vector_normalize.d.ts.map +1 -0
  92. package/src/core/{math/vector_nd_normalize.js → geom/vec/vector_normalize.js} +1 -1
  93. package/src/core/geom/vec/vector_normalize.spec.d.ts +2 -0
  94. package/src/core/geom/vec/vector_normalize.spec.d.ts.map +1 -0
  95. package/src/core/{math/vector_nd_normalize.spec.js → geom/vec/vector_normalize.spec.js} +3 -3
  96. package/src/core/geom/vec/vector_scale_array.d.ts +11 -0
  97. package/src/core/geom/vec/vector_scale_array.d.ts.map +1 -0
  98. package/src/core/geom/vec/vector_scale_array.js +31 -0
  99. package/src/core/geom/vec3/v3_dot_array_array.js +2 -0
  100. package/src/core/geom/vec3/v3_matrix4_multiply.d.ts +10 -0
  101. package/src/core/geom/vec3/v3_matrix4_multiply.d.ts.map +1 -0
  102. package/src/core/geom/vec3/v3_matrix4_multiply.js +27 -0
  103. package/src/core/geom/vec3/v3_shift_along_direction.d.ts +14 -0
  104. package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +1 -0
  105. package/src/core/geom/vec3/v3_shift_along_direction.js +23 -0
  106. package/src/core/math/compute_legendre_polynomial.d.ts +10 -0
  107. package/src/core/math/compute_legendre_polynomial.d.ts.map +1 -0
  108. package/src/core/math/compute_legendre_polynomial.js +46 -0
  109. package/src/core/math/statistics/softmax.d.ts +11 -0
  110. package/src/core/math/statistics/softmax.d.ts.map +1 -0
  111. package/src/core/math/statistics/softmax.js +24 -0
  112. package/src/core/math/statistics/softmax.spec.d.ts +2 -0
  113. package/src/core/math/statistics/softmax.spec.d.ts.map +1 -0
  114. package/src/core/math/statistics/softmax.spec.js +9 -0
  115. package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
  116. package/src/core/model/node-graph/node/NodeInstance.js +18 -0
  117. package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
  118. package/src/engine/ecs/transform/Transform.js +19 -4
  119. package/src/engine/graphics/ecs/camera/CameraSystem.d.ts.map +1 -1
  120. package/src/engine/graphics/ecs/camera/CameraSystem.js +25 -13
  121. package/src/engine/graphics/geometry/decode_attribute_value.d.ts +10 -0
  122. package/src/engine/graphics/geometry/decode_attribute_value.d.ts.map +1 -0
  123. package/src/engine/graphics/geometry/decode_attribute_value.js +28 -0
  124. package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts +11 -0
  125. package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts.map +1 -0
  126. package/src/engine/graphics/geometry/geometry_construct_triangle_normal.js +31 -0
  127. package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -1
  128. package/src/engine/graphics/sh3/fromCubeRenderTarget.js +14 -17
  129. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -2
  130. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  131. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +21 -97
  132. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  133. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +8 -15
  134. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +1 -0
  135. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -1
  136. package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +6 -2
  137. package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.d.ts → BufferedGeometryBVH.d.ts} +9 -2
  138. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -0
  139. package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.js → BufferedGeometryBVH.js} +84 -5
  140. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +6 -4
  141. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
  142. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +54 -8
  143. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +6 -10
  144. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
  145. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +41 -47
  146. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts +11 -0
  147. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -0
  148. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +102 -0
  149. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +9 -0
  150. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -0
  151. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +17 -0
  152. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +31 -0
  153. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -0
  154. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +85 -0
  155. package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts +14 -0
  156. package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts.map +1 -0
  157. package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.js +17 -0
  158. package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts +7 -0
  159. package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts.map +1 -0
  160. package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.js +9 -0
  161. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +104 -9
  162. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +1 -2
  163. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
  164. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +50 -23
  165. package/src/engine/graphics/sh3/prototypeSH3Probe.js +79 -29
  166. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +11 -1
  167. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -1
  168. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +33 -16
  169. package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts +8 -0
  170. package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts.map +1 -0
  171. package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.js +10 -0
  172. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +8 -0
  173. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +1 -0
  174. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.js +23 -0
  175. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map +1 -1
  176. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +6 -6
  177. package/src/core/binary/de_interleave_bits_by_2.d.ts.map +0 -1
  178. package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +0 -8
  179. package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +0 -1
  180. package/src/core/math/vector_nd_dot.d.ts.map +0 -1
  181. package/src/core/math/vector_nd_normalize.d.ts.map +0 -1
  182. package/src/core/math/vector_nd_normalize.spec.d.ts +0 -2
  183. package/src/core/math/vector_nd_normalize.spec.d.ts.map +0 -1
  184. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +0 -1
  185. /package/src/core/binary/{de_interleave_bits_by_2.js → de_interleave_2_bits.js} +0 -0
@@ -0,0 +1,22 @@
1
+ import { int32_to_binary_string } from "./int32_to_binary_string.js";
2
+ import { split_by_2 } from "./split_by_2.js";
3
+
4
+ test("zero", () => {
5
+
6
+ expect(split_by_2(0)).toEqual(0);
7
+
8
+ });
9
+
10
+ test("max value", () => {
11
+
12
+ expect(
13
+ int32_to_binary_string(split_by_2(0xFFFFFFFF))
14
+ ).toEqual("01010101 01010101 01010101 01010101");
15
+
16
+ });
17
+
18
+ test("max 16bit value", () => {
19
+ expect(
20
+ int32_to_binary_string(split_by_2(0b1111111111111111))
21
+ ).toEqual("01010101 01010101 01010101 01010101");
22
+ });
@@ -4,6 +4,9 @@
4
4
  * @param {BVH} bvh
5
5
  * @param {number[]|Float32Array} index_array
6
6
  * @param {number[]|Float32Array} position_array
7
+ * @param {Uint32Array} [morton_codes]
8
+ * @param {AABB3} [bounds]
7
9
  */
8
- export function ebvh_build_for_geometry_morton(bvh: BVH, index_array: number[] | Float32Array, position_array: number[] | Float32Array): void;
10
+ export function ebvh_build_for_geometry_morton(bvh: BVH, index_array: number[] | Float32Array, position_array: number[] | Float32Array, morton_codes?: Uint32Array, bounds?: AABB3): void;
11
+ import { AABB3 } from "../../geom/3d/aabb/AABB3.js";
9
12
  //# sourceMappingURL=ebvh_build_for_geometry_morton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,sEAHW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,QAoF/B"}
1
+ {"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,QA2Ff;sBA1GqB,6BAA6B"}
@@ -15,8 +15,16 @@ import { ebvh_build_hierarchy } from "./ebvh_build_hierarchy.js";
15
15
  * @param {BVH} bvh
16
16
  * @param {number[]|Float32Array} index_array
17
17
  * @param {number[]|Float32Array} position_array
18
+ * @param {Uint32Array} [morton_codes]
19
+ * @param {AABB3} [bounds]
18
20
  */
19
- export function ebvh_build_for_geometry_morton(bvh, index_array, position_array) {
21
+ export function ebvh_build_for_geometry_morton(
22
+ bvh,
23
+ index_array,
24
+ position_array,
25
+ morton_codes = new Uint32Array(index_array.length / 3),
26
+ bounds = new AABB3()
27
+ ) {
20
28
  assert.defined(bvh, 'bvh');
21
29
 
22
30
  assert.defined(index_array, 'index_array');
@@ -25,16 +33,19 @@ export function ebvh_build_for_geometry_morton(bvh, index_array, position_array)
25
33
  assert.defined(position_array, 'position_array');
26
34
  assert.isArrayLike(position_array, 'position_array');
27
35
 
36
+ assert.isArrayLike(morton_codes, 'morton_codes');
37
+
28
38
  // clear out existing BVH
29
39
  bvh.release_all();
30
40
 
31
- const aabb3 = new AABB3();
32
-
33
41
  // get bounds for the entire geometry
34
- aabb3_from_v3_array(aabb3, position_array, position_array.length);
42
+ aabb3_from_v3_array(bounds, position_array, position_array.length);
35
43
 
36
44
  // allocate nodes
37
45
  const tri_count = index_array.length / 3;
46
+
47
+ assert.greaterThanOrEqual(morton_codes.length, tri_count);
48
+
38
49
  const node_leaf_count = tri_count;
39
50
  const node_bin_count = max2(0, node_leaf_count - 1);
40
51
 
@@ -59,9 +70,7 @@ export function ebvh_build_for_geometry_morton(bvh, index_array, position_array)
59
70
  sorted_triangle_order[i] = i;
60
71
  }
61
72
 
62
- const morton_codes = new Uint32Array(tri_count);
63
-
64
- build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, aabb3.x0, aabb3.y0, aabb3.z0, aabb3.x1, aabb3.y1, aabb3.z1);
73
+ build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, bounds.x0, bounds.y0, bounds.z0, bounds.x1, bounds.y1, bounds.z1);
65
74
 
66
75
  // sort leaves by morton codes
67
76
  array_quick_sort_by_lookup(sorted_triangle_order, morton_codes, 0, tri_count - 1);
@@ -35,8 +35,8 @@ export function ebvh_build_hierarchy(
35
35
  let cursor = 0;
36
36
 
37
37
  while (cursor + 1 < unprocessed_node_count) {
38
- const child_1 = unprocessed_nodes[cursor++];
39
38
  const child_2 = unprocessed_nodes[cursor++];
39
+ const child_1 = unprocessed_nodes[cursor++];
40
40
 
41
41
  const parent = node_pool[used_index++];
42
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"bvh_query_user_data_ray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wDAXW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,CAwElB"}
1
+ {"version":3,"file":"bvh_query_user_data_ray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wDAXW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,CA6ElB"}
@@ -29,14 +29,19 @@ export function bvh_query_user_data_ray(
29
29
  return 0;
30
30
  }
31
31
 
32
+ /**
33
+ * Move stack pointer to local variable scope to avoid de-referencing inside the loop
34
+ * @type {number}
35
+ */
36
+ let pointer = stack.pointer;
32
37
 
33
38
  /**
34
39
  *
35
40
  * @type {number}
36
41
  */
37
- const stack_top = stack.pointer++;
42
+ const stack_top = pointer;
38
43
 
39
- stack[stack_top] = root;
44
+ stack[pointer++] = root;
40
45
 
41
46
  let result_cursor = result_offset;
42
47
 
@@ -47,13 +52,13 @@ export function bvh_query_user_data_ray(
47
52
  const uint32 = bvh.__data_uint32;
48
53
 
49
54
  do {
50
- stack.pointer--;
55
+ --pointer;
51
56
 
52
57
  /**
53
58
  *
54
59
  * @type {number}
55
60
  */
56
- const node = stack[stack.pointer];
61
+ const node = stack[pointer];
57
62
 
58
63
  const address = node * ELEMENT_WORD_COUNT;
59
64
 
@@ -77,15 +82,15 @@ export function bvh_query_user_data_ray(
77
82
  // this is not a leaf node, push children onto traversal stack
78
83
  const child_2 = uint32[address + COLUMN_CHILD_2];
79
84
 
80
- stack[stack.pointer++] = child_2;
81
- stack[stack.pointer++] = child_1;
85
+ stack[pointer++] = child_2;
86
+ stack[pointer++] = child_1;
82
87
 
83
88
  } else {
84
89
  // leaf node
85
90
 
86
91
  result[result_cursor++] = uint32[address + COLUMN_USER_DATA];
87
92
  }
88
- } while (stack.pointer > stack_top);
93
+ } while (pointer > stack_top);
89
94
 
90
95
  return result_cursor - result_offset;
91
96
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {number} radius
4
+ * @returns {number}
5
+ */
6
+ export function circle_circumference(radius: number): number;
7
+ //# sourceMappingURL=circle_circumference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle_circumference.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/circle/circle_circumference.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,6CAHW,MAAM,GACJ,MAAM,CAMlB"}
@@ -0,0 +1,12 @@
1
+ import { assert } from "../../../assert.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number} radius
6
+ * @returns {number}
7
+ */
8
+ export function circle_circumference(radius) {
9
+ assert.isNumber(radius, 'radius');
10
+
11
+ return 2 * Math.PI * radius;
12
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"compute_polygon_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_polygon_area_2d.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,CA2BlB"}
1
+ {"version":3,"file":"compute_polygon_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_polygon_area_2d.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,CA6BlB"}
@@ -8,11 +8,13 @@ export function compute_polygon_area_2d(points, point_count) {
8
8
  let sum = 0;
9
9
 
10
10
  for (let i = 0; i < point_count - 1; i++) {
11
- const x0 = points[(i) * 2];
12
- const y0 = points[(i) * 2 + 1];
11
+ const i2 = i * 2;
13
12
 
14
- const x1 = points[(i + 1) * 2];
15
- const y1 = points[(i + 1) * 2 + 1];
13
+ const x0 = points[i2];
14
+ const y0 = points[i2 + 1];
15
+
16
+ const x1 = points[i2 + 2];
17
+ const y1 = points[i2 + 3];
16
18
 
17
19
  sum += x0 * y1 - y0 * x1;
18
20
  }
@@ -1,5 +1,5 @@
1
1
  import { assert } from "../../../assert.js";
2
- import { de_interleave_2_bits } from "../../../binary/de_interleave_bits_by_2.js";
2
+ import { de_interleave_2_bits } from "../../../binary/de_interleave_2_bits.js";
3
3
  import { split_by_2 } from "../../../binary/split_by_2.js";
4
4
  import { UINT32_MAX } from "../../../binary/UINT32_MAX.js";
5
5
  import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
@@ -8,8 +8,8 @@
8
8
  * @param {number} by
9
9
  * @param {number} cx
10
10
  * @param {number} cy
11
- * @param {number} px
12
- * @param {number} py
11
+ * @param {number} px reference point X
12
+ * @param {number} py reference point Y
13
13
  */
14
14
  export function triangle2d_get_barycentric(output: number[], output_offset: number, ax: number, ay: number, bx: number, by: number, cx: number, cy: number, px: number, py: number): void;
15
15
  //# sourceMappingURL=triangle2d_get_barycentric.d.ts.map
@@ -10,8 +10,8 @@ import { v2_dot } from "../vec2/v2_dot.js";
10
10
  * @param {number} by
11
11
  * @param {number} cx
12
12
  * @param {number} cy
13
- * @param {number} px
14
- * @param {number} py
13
+ * @param {number} px reference point X
14
+ * @param {number} py reference point Y
15
15
  */
16
16
  export function triangle2d_get_barycentric(
17
17
  output, output_offset,
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 3D ray
3
+ */
4
+ export class Ray3 {
5
+ origin: Vector3;
6
+ direction: Vector3;
7
+ /**
8
+ *
9
+ * @param {number[]|mat4|Float32Array} m4
10
+ */
11
+ applyMatrix4(m4: number[] | mat4 | Float32Array): void;
12
+ /**
13
+ *
14
+ * @param {Ray3} other
15
+ */
16
+ copy(other: Ray3): void;
17
+ }
18
+ import Vector3 from "../Vector3.js";
19
+ //# sourceMappingURL=Ray3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI,gBAAsB;IACtB,mBAAyB;IAEzB;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAKpC;IAED;;;OAGG;IACH,YAFW,IAAI,QAKd;CACJ;oBA1BmB,eAAe"}
@@ -0,0 +1,27 @@
1
+ import Vector3 from "../Vector3.js";
2
+
3
+ /**
4
+ * 3D ray
5
+ */
6
+ export class Ray3 {
7
+ origin = new Vector3()
8
+ direction = new Vector3()
9
+
10
+ /**
11
+ *
12
+ * @param {number[]|mat4|Float32Array} m4
13
+ */
14
+ applyMatrix4(m4) {
15
+ this.origin.applyMatrix4(m4);
16
+ this.direction.applyDirectionMatrix4(m4);
17
+ }
18
+
19
+ /**
20
+ *
21
+ * @param {Ray3} other
22
+ */
23
+ copy(other) {
24
+ this.origin.copy(other.origin);
25
+ this.direction.copy(other.direction);
26
+ }
27
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * @param {number[]|ArrayLike<number>|Float32Array} output 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
4
+ * @param {number} output_offset
5
+ * @param {number[]|ArrayLike<number>|Float32Array} input 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
6
+ * @param {number} input_offset
7
+ * @param {number} distance
8
+ */
9
+ export function ray3_shift_origin_along_direction(output: number[] | ArrayLike<number> | Float32Array, output_offset: number, input: number[] | ArrayLike<number> | Float32Array, input_offset: number, distance: number): void;
10
+ //# sourceMappingURL=ray3_shift_origin_along_direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray3_shift_origin_along_direction.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_shift_origin_along_direction.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0DANW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,iBACvC,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,gBACvC,MAAM,YACN,MAAM,QAyBhB"}
@@ -0,0 +1,35 @@
1
+ import { v3_shift_along_direction } from "../../vec3/v3_shift_along_direction.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number[]|ArrayLike<number>|Float32Array} output 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
6
+ * @param {number} output_offset
7
+ * @param {number[]|ArrayLike<number>|Float32Array} input 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
8
+ * @param {number} input_offset
9
+ * @param {number} distance
10
+ */
11
+ export function ray3_shift_origin_along_direction(
12
+ output, output_offset,
13
+ input, input_offset,
14
+ distance
15
+ ) {
16
+ const origin_x = input[input_offset + 0];
17
+ const origin_y = input[input_offset + 1];
18
+ const origin_z = input[input_offset + 2];
19
+
20
+ const direction_x = input[input_offset + 3];
21
+ const direction_y = input[input_offset + 4];
22
+ const direction_z = input[input_offset + 5];
23
+
24
+ v3_shift_along_direction(
25
+ output, 0,
26
+ origin_x, origin_y, origin_z,
27
+ direction_x, direction_y, direction_z,
28
+ distance
29
+ );
30
+
31
+ output[output_offset + 3] = direction_x;
32
+ output[output_offset + 4] = direction_y;
33
+ output[output_offset + 5] = direction_z;
34
+ }
35
+
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=compute_legendre_polynomial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_legendre_polynomial.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.js"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Performs convolution of 3-band spherical harmonic coefficients with a cosine kernel
3
+ * @param {number[]} out
4
+ * @param {number} out_offset
5
+ * @param {number[]} input
6
+ * @param {number} input_offset
7
+ */
8
+ export function sh3_convolve_with_cosine_kernel(out: number[], out_offset: number, input: number[], input_offset: number): void;
9
+ //# sourceMappingURL=sh3_convolve_with_cosine_kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh3_convolve_with_cosine_kernel.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qDALW,MAAM,EAAE,cACR,MAAM,SACN,MAAM,EAAE,gBACR,MAAM,QAchB"}
@@ -0,0 +1,26 @@
1
+ // Cosine kernel for SH
2
+ const CosineA0 = Math.PI;
3
+ const CosineA1 = (2.0 * Math.PI) / 3.0;
4
+ const CosineA2 = Math.PI / 4.0;
5
+
6
+ /**
7
+ * Performs convolution of 3-band spherical harmonic coefficients with a cosine kernel
8
+ * @param {number[]} out
9
+ * @param {number} out_offset
10
+ * @param {number[]} input
11
+ * @param {number} input_offset
12
+ */
13
+ export function sh3_convolve_with_cosine_kernel(out, out_offset, input, input_offset) {
14
+ out[out_offset + 0] = input[input_offset + 0] * CosineA0;
15
+
16
+ out[out_offset + 1] = input[input_offset + 1] * CosineA1;
17
+ out[out_offset + 2] = input[input_offset + 2] * CosineA1;
18
+ out[out_offset + 3] = input[input_offset + 3] * CosineA1;
19
+
20
+ out[out_offset + 4] = input[input_offset + 4] * CosineA2;
21
+ out[out_offset + 5] = input[input_offset + 5] * CosineA2;
22
+ out[out_offset + 6] = input[input_offset + 6] * CosineA2;
23
+ out[out_offset + 7] = input[input_offset + 7] * CosineA2;
24
+ out[out_offset + 8] = input[input_offset + 8] * CosineA2;
25
+ }
26
+
@@ -1 +1 @@
1
- {"version":3,"file":"sh3_dering_optimize_positive.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js"],"names":[],"mappings":"AAkSA;;;;;;;GAOG;AACH,qDANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,oBAClC,MAAM,oBACN,MAAM,QAIhB"}
1
+ {"version":3,"file":"sh3_dering_optimize_positive.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js"],"names":[],"mappings":"AAgSA;;;;;;;GAOG;AACH,qDANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,oBAClC,MAAM,oBACN,MAAM,QAIhB"}
@@ -3,7 +3,7 @@ import { assert } from "../../../../assert.js";
3
3
  import { array_copy } from "../../../../collection/array/array_copy.js";
4
4
  import { min2 } from "../../../../math/min2.js";
5
5
  import { SH3_COEFFICIENTS } from "./SH3_COEFFICIENTS.js";
6
- import { sh3_rotate } from "./sh3_rotate.js";
6
+ import { sh3_rotate_bl } from "./sh3_rotate_bl.js";
7
7
  import { sh_index } from "./sh_index.js";
8
8
 
9
9
  /*
@@ -74,11 +74,9 @@ function sh3_min(input_sh3) {
74
74
  array_copy(y_axis, 0, M, 3, 3);
75
75
  array_copy(dir, 0, M, 6, 3);
76
76
 
77
- mat3.transpose(M, M);
78
-
79
77
  const f = new Float32Array(9);
80
78
 
81
- sh3_rotate(f, input_sh3, M);
79
+ sh3_rotate_bl(f, input_sh3, M);
82
80
  // here we're guaranteed to have normalize(float3{ -f[3], -f[1], f[2] }) == { 0, 0, 1 }
83
81
 
84
82
 
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float32Array} result sh3
4
+ * @param {number[]} sh input
5
+ * @param {number[]} rotation 3x3 rotation matrix
6
+ */
7
+ export function sh3_rotate_bl(result: number[] | Float32Array, sh: number[], rotation: number[]): number[] | Float32Array;
8
+ //# sourceMappingURL=sh3_rotate_bl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh3_rotate_bl.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,sCAJW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,YACR,MAAM,EAAE,2BAuFlB"}
@@ -0,0 +1,94 @@
1
+ const scratch_mat_5x5 = new Float64Array(25);
2
+
3
+ /**
4
+ *
5
+ * @param {number[]|Float32Array} result sh3
6
+ * @param {number[]} sh input
7
+ * @param {number[]} rotation 3x3 rotation matrix
8
+ */
9
+ export function sh3_rotate_bl(result, sh, rotation) {
10
+ // Implementation adapted from BakerLab by https://github.com/TheRealMJP
11
+
12
+ const r00 = rotation[0];
13
+ const r10 = rotation[1];
14
+ const r20 = rotation[2];
15
+
16
+ const r01 = rotation[3];
17
+ const r11 = rotation[4];
18
+ const r21 = rotation[5];
19
+
20
+ const r02 = rotation[6];
21
+ const r12 = rotation[7];
22
+ const r22 = rotation[8];
23
+
24
+
25
+ // Constant
26
+ result[0] = sh[0];
27
+
28
+ // Linear
29
+ result[1] = r11 * sh[1] - r12 * sh[2] + r10 * sh[3];
30
+ result[2] = -r21 * sh[1] + r22 * sh[2] - r20 * sh[3];
31
+ result[3] = r01 * sh[1] - r02 * sh[2] + r00 * sh[3];
32
+
33
+ // Quadratic
34
+ const t41 = r01 * r00;
35
+ const t43 = r11 * r10;
36
+ const t48 = r11 * r12;
37
+ const t50 = r01 * r02;
38
+ const t55 = r02 * r02;
39
+ const t57 = r22 * r22;
40
+ const t58 = r12 * r12;
41
+ const t61 = r00 * r02;
42
+ const t63 = r10 * r12;
43
+ const t68 = r10 * r10;
44
+ const t70 = r01 * r01;
45
+ const t72 = r11 * r11;
46
+ const t74 = r00 * r00;
47
+ const t76 = r21 * r21;
48
+ const t78 = r20 * r20;
49
+
50
+ const v173 = 0.1732050808e1;
51
+ const v577 = 0.5773502693e0;
52
+ const v115 = 0.1154700539e1;
53
+ const v288 = 0.2886751347e0;
54
+ const v866 = 0.8660254040e0;
55
+
56
+ scratch_mat_5x5[0] = r11 * r00 + r01 * r10;
57
+ scratch_mat_5x5[1] = -r01 * r12 - r11 * r02;
58
+ scratch_mat_5x5[2] = v173 * r02 * r12;
59
+ scratch_mat_5x5[3] = -r10 * r02 - r00 * r12;
60
+ scratch_mat_5x5[4] = r00 * r10 - r01 * r11;
61
+ scratch_mat_5x5[5] = -r11 * r20 - r21 * r10;
62
+ scratch_mat_5x5[6] = r11 * r22 + r21 * r12;
63
+ scratch_mat_5x5[7] = -v173 * r22 * r12;
64
+ scratch_mat_5x5[8] = r20 * r12 + r10 * r22;
65
+ scratch_mat_5x5[9] = -r10 * r20 + r11 * r21;
66
+ scratch_mat_5x5[10] = -v577 * (t41 + t43) + v115 * r21 * r20;
67
+ scratch_mat_5x5[11] = v577 * (t48 + t50) - v115 * r21 * r22;
68
+ scratch_mat_5x5[12] = -0.5 * (t55 + t58) + t57;
69
+ scratch_mat_5x5[13] = v577 * (t61 + t63) - v115 * r20 * r22;
70
+ scratch_mat_5x5[14] = v288 * (t70 - t68 + t72 - t74) - v577 * (t76 - t78);
71
+ scratch_mat_5x5[15] = -r01 * r20 - r21 * r00;
72
+ scratch_mat_5x5[16] = r01 * r22 + r21 * r02;
73
+ scratch_mat_5x5[17] = -v173 * r22 * r02;
74
+ scratch_mat_5x5[18] = r00 * r22 + r20 * r02;
75
+ scratch_mat_5x5[19] = -r00 * r20 + r01 * r21;
76
+ scratch_mat_5x5[20] = t41 - t43;
77
+ scratch_mat_5x5[21] = -t50 + t48;
78
+ scratch_mat_5x5[22] = v866 * (t55 - t58);
79
+ scratch_mat_5x5[23] = t63 - t61;
80
+ scratch_mat_5x5[24] = 0.5 * (t74 - t68 - t70 + t72);
81
+
82
+ for (let i = 0; i < 5; ++i) {
83
+ const base = i * 5;
84
+
85
+ result[4 + i] = scratch_mat_5x5[base + 0] * sh[4]
86
+ + scratch_mat_5x5[base + 1] * sh[5]
87
+ + scratch_mat_5x5[base + 2] * sh[6]
88
+ + scratch_mat_5x5[base + 3] * sh[7]
89
+ + scratch_mat_5x5[base + 4] * sh[8]
90
+ ;
91
+ }
92
+
93
+ return result;
94
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float32Array} result sh3
4
+ * @param {number[]} sh input
5
+ * @param {number[]} rotation 3x3 rotation matrix
6
+ */
7
+ export function sh3_rotate_filament(result: number[] | Float32Array, sh: number[], rotation: number[]): void;
8
+ //# sourceMappingURL=sh3_rotate_filament.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh3_rotate_filament.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,4CAJW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,YACR,MAAM,EAAE,QAuBlB"}
@@ -7,7 +7,9 @@ import { sh_rotate_band2 } from "./sh_rotate_band2.js";
7
7
  * @param {number[]} sh input
8
8
  * @param {number[]} rotation 3x3 rotation matrix
9
9
  */
10
- export function sh3_rotate(result, sh, rotation) {
10
+ export function sh3_rotate_filament(result, sh, rotation) {
11
+
12
+ // Adapted from filament https://github.com/google/filament/blob/e2da13f81734ccd6d6f9935061b771801682619e/libs/ibl/src/CubemapSH.cpp
11
13
 
12
14
  const b0 = sh[0];
13
15
  const band1 = [sh[1], sh[2], sh[3]];
@@ -26,4 +28,5 @@ export function sh3_rotate(result, sh, rotation) {
26
28
  result[6] = b2[2];
27
29
  result[7] = b2[3];
28
30
  result[8] = b2[4];
29
- }
31
+ }
32
+
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float32Array|Float64Array} out
4
+ * @param {number} out_offset
5
+ * @param {number[]|Float32Array|Float64Array} basis
6
+ * @param {number} basis_offset
7
+ * @param {number[]|Float32Array|Float64Array} vector
8
+ * @param {number} vector_offset
9
+ * @param {number} dimensions
10
+ */
11
+ export function sh3_vector_accumulate(out: number[] | Float32Array | Float64Array, out_offset: number, basis: number[] | Float32Array | Float64Array, basis_offset: number, vector: number[] | Float32Array | Float64Array, vector_offset: number, dimensions: number): void;
12
+ //# sourceMappingURL=sh3_vector_accumulate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh3_vector_accumulate.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,2CARW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,cACN,MAAM,QA6BhB"}
@@ -0,0 +1,40 @@
1
+ import { assert } from "../../../../assert.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number[]|Float32Array|Float64Array} out
6
+ * @param {number} out_offset
7
+ * @param {number[]|Float32Array|Float64Array} basis
8
+ * @param {number} basis_offset
9
+ * @param {number[]|Float32Array|Float64Array} vector
10
+ * @param {number} vector_offset
11
+ * @param {number} dimensions
12
+ */
13
+ export function sh3_vector_accumulate(
14
+ out, out_offset,
15
+ basis, basis_offset,
16
+ vector, vector_offset, dimensions
17
+ ) {
18
+
19
+ assert.isArrayLike(out, 'out');
20
+ assert.isNonNegativeInteger(out_offset, 'out_offset');
21
+
22
+ assert.isArrayLike(basis, 'basis');
23
+ assert.isNonNegativeInteger(basis_offset, 'basis_offset');
24
+
25
+ assert.isNonNegativeInteger(dimensions, 'dimensions');
26
+
27
+ for (let j = 0; j < 9; j++) {
28
+
29
+ const out_coefficient_offset = out_offset + j * dimensions;
30
+
31
+ const basis_value = basis[basis_offset + j];
32
+
33
+ for (let i = 0; i < dimensions; i++) {
34
+ const scalar = vector[vector_offset + i];
35
+
36
+ out[out_coefficient_offset + i] += basis_value * scalar;
37
+ }
38
+
39
+ }
40
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sh3_vector_accumulate.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh3_vector_accumulate.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js"],"names":[],"mappings":""}