@galacean/engine-math 1.1.0-beta.14 → 1.1.0-beta.15

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.
@@ -2767,22 +2767,17 @@ function _create_class(Constructor, protoProps, staticProps) {
2767
2767
  var m11 = e[0];
2768
2768
  var m12 = e[1];
2769
2769
  var m13 = e[2];
2770
- var m14 = e[3];
2771
2770
  var m21 = e[4];
2772
2771
  var m22 = e[5];
2773
2772
  var m23 = e[6];
2774
- var m24 = e[7];
2775
2773
  var m31 = e[8];
2776
2774
  var m32 = e[9];
2777
2775
  var m33 = e[10];
2778
- var m34 = e[11];
2779
2776
  translation.set(e[12], e[13], e[14]);
2780
- var xs = Math.sign(m11 * m12 * m13 * m14) < 0 ? -1 : 1;
2781
- var ys = Math.sign(m21 * m22 * m23 * m24) < 0 ? -1 : 1;
2782
- var zs = Math.sign(m31 * m32 * m33 * m34) < 0 ? -1 : 1;
2783
- var sx = xs * Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2784
- var sy = ys * Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2785
- var sz = zs * Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2777
+ var sx = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2778
+ var sy = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2779
+ var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2780
+ if (this.determinant() < 0) sx = -sx;
2786
2781
  scale.set(sx, sy, sz);
2787
2782
  if (Math.abs(sx) < MathUtil.zeroTolerance || Math.abs(sy) < MathUtil.zeroTolerance || Math.abs(sz) < MathUtil.zeroTolerance) {
2788
2783
  rotation.identity();
package/dist/module.js CHANGED
@@ -2763,22 +2763,17 @@ function _create_class(Constructor, protoProps, staticProps) {
2763
2763
  var m11 = e[0];
2764
2764
  var m12 = e[1];
2765
2765
  var m13 = e[2];
2766
- var m14 = e[3];
2767
2766
  var m21 = e[4];
2768
2767
  var m22 = e[5];
2769
2768
  var m23 = e[6];
2770
- var m24 = e[7];
2771
2769
  var m31 = e[8];
2772
2770
  var m32 = e[9];
2773
2771
  var m33 = e[10];
2774
- var m34 = e[11];
2775
2772
  translation.set(e[12], e[13], e[14]);
2776
- var xs = Math.sign(m11 * m12 * m13 * m14) < 0 ? -1 : 1;
2777
- var ys = Math.sign(m21 * m22 * m23 * m24) < 0 ? -1 : 1;
2778
- var zs = Math.sign(m31 * m32 * m33 * m34) < 0 ? -1 : 1;
2779
- var sx = xs * Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2780
- var sy = ys * Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2781
- var sz = zs * Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2773
+ var sx = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2774
+ var sy = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2775
+ var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2776
+ if (this.determinant() < 0) sx = -sx;
2782
2777
  scale.set(sx, sy, sz);
2783
2778
  if (Math.abs(sx) < MathUtil.zeroTolerance || Math.abs(sy) < MathUtil.zeroTolerance || Math.abs(sz) < MathUtil.zeroTolerance) {
2784
2779
  rotation.identity();