@galacean/engine-math 1.1.0-beta.2 → 1.1.0-beta.21
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/dist/main.js +23 -15
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +23 -15
- package/dist/module.js +23 -15
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
package/dist/miniprogram.js
CHANGED
|
@@ -2234,14 +2234,27 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
2234
2234
|
};
|
|
2235
2235
|
};
|
|
2236
2236
|
_proto._toYawPitchRoll = function _toYawPitchRoll(out) {
|
|
2237
|
-
//
|
|
2237
|
+
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/
|
|
2238
2238
|
var _this = this, x = _this._x, y = _this._y, z = _this._z, w = _this._w;
|
|
2239
2239
|
var xx = x * x;
|
|
2240
|
-
var
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2240
|
+
var yy = y * y;
|
|
2241
|
+
var zz = z * z;
|
|
2242
|
+
var ww = w * w;
|
|
2243
|
+
var unit = xx + yy + zz + ww;
|
|
2244
|
+
var test = 2 * (x * w - y * z);
|
|
2245
|
+
if (test > (1 - MathUtil.zeroTolerance) * unit) {
|
|
2246
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
|
|
2247
|
+
out._y = Math.PI / 2;
|
|
2248
|
+
out._z = 0;
|
|
2249
|
+
} else if (test < -(1 - MathUtil.zeroTolerance) * unit) {
|
|
2250
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
|
|
2251
|
+
out._y = -Math.PI / 2;
|
|
2252
|
+
out._z = 0;
|
|
2253
|
+
} else {
|
|
2254
|
+
out._x = Math.atan2(2.0 * (z * x + y * w), zz + ww - yy - xx);
|
|
2255
|
+
out._y = Math.asin(test / unit);
|
|
2256
|
+
out._z = Math.atan2(2.0 * (x * y + z * w), yy + ww - zz - xx);
|
|
2257
|
+
}
|
|
2245
2258
|
};
|
|
2246
2259
|
/**
|
|
2247
2260
|
* Determines the sum of two quaternions.
|
|
@@ -2767,22 +2780,17 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
2767
2780
|
var m11 = e[0];
|
|
2768
2781
|
var m12 = e[1];
|
|
2769
2782
|
var m13 = e[2];
|
|
2770
|
-
var m14 = e[3];
|
|
2771
2783
|
var m21 = e[4];
|
|
2772
2784
|
var m22 = e[5];
|
|
2773
2785
|
var m23 = e[6];
|
|
2774
|
-
var m24 = e[7];
|
|
2775
2786
|
var m31 = e[8];
|
|
2776
2787
|
var m32 = e[9];
|
|
2777
2788
|
var m33 = e[10];
|
|
2778
|
-
var m34 = e[11];
|
|
2779
2789
|
translation.set(e[12], e[13], e[14]);
|
|
2780
|
-
var
|
|
2781
|
-
var
|
|
2782
|
-
var
|
|
2783
|
-
|
|
2784
|
-
var sy = ys * Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
|
|
2785
|
-
var sz = zs * Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
|
|
2790
|
+
var sx = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
|
|
2791
|
+
var sy = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
|
|
2792
|
+
var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
|
|
2793
|
+
if (this.determinant() < 0) sx = -sx;
|
|
2786
2794
|
scale.set(sx, sy, sz);
|
|
2787
2795
|
if (Math.abs(sx) < MathUtil.zeroTolerance || Math.abs(sy) < MathUtil.zeroTolerance || Math.abs(sz) < MathUtil.zeroTolerance) {
|
|
2788
2796
|
rotation.identity();
|
package/dist/module.js
CHANGED
|
@@ -2230,14 +2230,27 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
2230
2230
|
};
|
|
2231
2231
|
};
|
|
2232
2232
|
_proto._toYawPitchRoll = function _toYawPitchRoll(out) {
|
|
2233
|
-
//
|
|
2233
|
+
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/
|
|
2234
2234
|
var _this = this, x = _this._x, y = _this._y, z = _this._z, w = _this._w;
|
|
2235
2235
|
var xx = x * x;
|
|
2236
|
-
var
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2236
|
+
var yy = y * y;
|
|
2237
|
+
var zz = z * z;
|
|
2238
|
+
var ww = w * w;
|
|
2239
|
+
var unit = xx + yy + zz + ww;
|
|
2240
|
+
var test = 2 * (x * w - y * z);
|
|
2241
|
+
if (test > (1 - MathUtil.zeroTolerance) * unit) {
|
|
2242
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
|
|
2243
|
+
out._y = Math.PI / 2;
|
|
2244
|
+
out._z = 0;
|
|
2245
|
+
} else if (test < -(1 - MathUtil.zeroTolerance) * unit) {
|
|
2246
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
|
|
2247
|
+
out._y = -Math.PI / 2;
|
|
2248
|
+
out._z = 0;
|
|
2249
|
+
} else {
|
|
2250
|
+
out._x = Math.atan2(2.0 * (z * x + y * w), zz + ww - yy - xx);
|
|
2251
|
+
out._y = Math.asin(test / unit);
|
|
2252
|
+
out._z = Math.atan2(2.0 * (x * y + z * w), yy + ww - zz - xx);
|
|
2253
|
+
}
|
|
2241
2254
|
};
|
|
2242
2255
|
/**
|
|
2243
2256
|
* Determines the sum of two quaternions.
|
|
@@ -2763,22 +2776,17 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
2763
2776
|
var m11 = e[0];
|
|
2764
2777
|
var m12 = e[1];
|
|
2765
2778
|
var m13 = e[2];
|
|
2766
|
-
var m14 = e[3];
|
|
2767
2779
|
var m21 = e[4];
|
|
2768
2780
|
var m22 = e[5];
|
|
2769
2781
|
var m23 = e[6];
|
|
2770
|
-
var m24 = e[7];
|
|
2771
2782
|
var m31 = e[8];
|
|
2772
2783
|
var m32 = e[9];
|
|
2773
2784
|
var m33 = e[10];
|
|
2774
|
-
var m34 = e[11];
|
|
2775
2785
|
translation.set(e[12], e[13], e[14]);
|
|
2776
|
-
var
|
|
2777
|
-
var
|
|
2778
|
-
var
|
|
2779
|
-
|
|
2780
|
-
var sy = ys * Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
|
|
2781
|
-
var sz = zs * Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
|
|
2786
|
+
var sx = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
|
|
2787
|
+
var sy = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
|
|
2788
|
+
var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
|
|
2789
|
+
if (this.determinant() < 0) sx = -sx;
|
|
2782
2790
|
scale.set(sx, sy, sz);
|
|
2783
2791
|
if (Math.abs(sx) < MathUtil.zeroTolerance || Math.abs(sy) < MathUtil.zeroTolerance || Math.abs(sz) < MathUtil.zeroTolerance) {
|
|
2784
2792
|
rotation.identity();
|