@woosh/meep-engine 2.84.8 → 2.84.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/meep.cjs CHANGED
@@ -2640,35 +2640,32 @@ let Vector3$1 = class Vector3 {
2640
2640
 
2641
2641
  /**
2642
2642
  *
2643
- * @param {ArrayList<number>|number[]|Float32Array} m4
2643
+ * @param {ArrayLike<number>|number[]|Float32Array} m4
2644
2644
  */
2645
2645
  applyMatrix4(m4) {
2646
2646
  const x = this.x;
2647
2647
  const y = this.y;
2648
2648
  const z = this.z;
2649
2649
 
2650
- const _x = m4[0] * x + m4[4] * y + m4[8] * z + m4[12];
2651
- const _y = m4[1] * x + m4[5] * y + m4[9] * z + m4[13];
2652
- const _z = m4[2] * x + m4[6] * y + m4[10] * z + m4[14];
2650
+ const w = 1 / (m4[3] * x + m4[7] * y + m4[11] * z + m4[15]);
2651
+
2652
+ const _x = (m4[0] * x + m4[4] * y + m4[8] * z + m4[12])* w;
2653
+ const _y = (m4[1] * x + m4[5] * y + m4[9] * z + m4[13])* w;
2654
+ const _z = (m4[2] * x + m4[6] * y + m4[10] * z + m4[14])* w;
2653
2655
 
2654
2656
  this.set(_x, _y, _z);
2655
2657
  }
2656
2658
 
2657
2659
  /**
2658
2660
  * Assume current vector holds a direction, transform using a matrix to produce a new directional unit vector
2659
- * @param {THREE.Matrix4} m
2661
+ * @param {ArrayLike<number>|number[]|Float32Array} m4
2660
2662
  */
2661
- transformDirection_three(m) {
2662
-
2663
- // input: THREE.Matrix4 affine matrix
2664
- // vector interpreted as a direction
2665
-
2663
+ applyDirectionMatrix4(m4){
2666
2664
  const x = this.x, y = this.y, z = this.z;
2667
- const e = m.elements;
2668
2665
 
2669
- const _x = e[0] * x + e[4] * y + e[8] * z;
2670
- const _y = e[1] * x + e[5] * y + e[9] * z;
2671
- const _z = e[2] * x + e[6] * y + e[10] * z;
2666
+ const _x = m4[0] * x + m4[4] * y + m4[8] * z;
2667
+ const _y = m4[1] * x + m4[5] * y + m4[9] * z;
2668
+ const _z = m4[2] * x + m4[6] * y + m4[10] * z;
2672
2669
 
2673
2670
  // normalize the result
2674
2671
  const _l = 1 / v3_length(_x, _y, _z);
@@ -2680,6 +2677,20 @@ let Vector3$1 = class Vector3 {
2680
2677
  );
2681
2678
  }
2682
2679
 
2680
+ /**
2681
+ * @deprecated use non-three.js version instead
2682
+ * @param {THREE.Matrix4} m
2683
+ */
2684
+ transformDirection_three(m) {
2685
+
2686
+ // input: THREE.Matrix4 affine matrix
2687
+ // vector interpreted as a direction
2688
+
2689
+ const e = m.elements;
2690
+
2691
+ this.applyDirectionMatrix4(e);
2692
+ }
2693
+
2683
2694
  /**
2684
2695
  *
2685
2696
  * @param {THREE.Matrix3} m
@@ -4743,7 +4754,7 @@ class Transform {
4743
4754
  get forward() {
4744
4755
  const result = Vector3$1.forward.clone();
4745
4756
 
4746
- result.applyMatrix4(this.matrix);
4757
+ result.applyDirectionMatrix4(this.matrix);
4747
4758
 
4748
4759
  return result;
4749
4760
  }
@@ -47191,44 +47202,8 @@ class SurfacePoint3 {
47191
47202
  */
47192
47203
  applyMatrix4(m) {
47193
47204
 
47194
- // transform position
47195
- const p = this.position;
47196
-
47197
- const p_x = p.x;
47198
- const p_y = p.y;
47199
- const p_z = p.z;
47200
-
47201
- // compute perspective projection
47202
- const w = 1 / (m[3] * p_x + m[7] * p_y + m[11] * p_z + m[15]);
47203
-
47204
- const result_p_x = (m[0] * p_x + m[4] * p_y + m[8] * p_z + m[12]) * w;
47205
- const result_p_y = (m[1] * p_x + m[5] * p_y + m[9] * p_z + m[13]) * w;
47206
- const result_p_z = (m[2] * p_x + m[6] * p_y + m[10] * p_z + m[14]) * w;
47207
-
47208
- p.set(
47209
- result_p_x,
47210
- result_p_y,
47211
- result_p_z
47212
- );
47213
-
47214
- // transform normal
47215
- const n = this.normal;
47216
-
47217
- const n_x = n.x;
47218
- const n_y = n.y;
47219
- const n_z = n.z;
47220
-
47221
- const result_n_x = m[0] * n_x + m[4] * n_y + m[8] * n_z;
47222
- const result_n_y = m[1] * n_x + m[5] * n_y + m[9] * n_z;
47223
- const result_n_z = m[2] * n_x + m[6] * n_y + m[10] * n_z;
47224
-
47225
- const normal_multiplier = 1 / v3_length(result_n_x, result_n_y, result_n_z);
47226
-
47227
- n.set(
47228
- result_n_x * normal_multiplier,
47229
- result_n_y * normal_multiplier,
47230
- result_n_z * normal_multiplier,
47231
- );
47205
+ this.position.applyMatrix4(m);
47206
+ this.normal.applyDirectionMatrix4(m);
47232
47207
  }
47233
47208
 
47234
47209
  /**