@galacean/engine-math 1.0.0-alpha.6 → 1.0.0-beta.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.
package/dist/main.js CHANGED
@@ -33,19 +33,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
33
33
  })(exports.FrustumFace || (exports.FrustumFace = {}));
34
34
 
35
35
  function _defineProperties(target, props) {
36
- for (var i = 0; i < props.length; i++) {
37
- var descriptor = props[i];
38
- descriptor.enumerable = descriptor.enumerable || false;
39
- descriptor.configurable = true;
40
- if ("value" in descriptor) descriptor.writable = true;
41
- Object.defineProperty(target, descriptor.key, descriptor);
42
- }
36
+ for (var i = 0; i < props.length; i++) {
37
+ var descriptor = props[i];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+
41
+ if ("value" in descriptor) descriptor.writable = true;
42
+
43
+ Object.defineProperty(target, descriptor.key, descriptor);
44
+ }
43
45
  }
46
+ function _create_class(Constructor, protoProps, staticProps) {
47
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
48
+ if (staticProps) _defineProperties(Constructor, staticProps);
44
49
 
45
- function _createClass(Constructor, protoProps, staticProps) {
46
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
47
- if (staticProps) _defineProperties(Constructor, staticProps);
48
- return Constructor;
50
+ return Constructor;
49
51
  }
50
52
 
51
53
  /**
@@ -93,9 +95,15 @@ function _createClass(Constructor, protoProps, staticProps) {
93
95
  };
94
96
  return MathUtil;
95
97
  }();
96
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
97
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
98
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
98
+ (function() {
99
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
100
+ })();
101
+ (function() {
102
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
103
+ })();
104
+ (function() {
105
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
106
+ })();
99
107
 
100
108
  /**
101
109
  * Describes a 3D-vector.
@@ -554,7 +562,7 @@ function _createClass(Constructor, protoProps, staticProps) {
554
562
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
555
563
  out._onValueChanged && out._onValueChanged();
556
564
  };
557
- _createClass(Vector3, [
565
+ _create_class(Vector3, [
558
566
  {
559
567
  key: "x",
560
568
  get: /**
@@ -594,8 +602,12 @@ function _createClass(Constructor, protoProps, staticProps) {
594
602
  ]);
595
603
  return Vector3;
596
604
  }();
597
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
598
- /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
605
+ (function() {
606
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
607
+ })();
608
+ (function() {
609
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
610
+ })();
599
611
 
600
612
  /**
601
613
  * A bounding sphere.
@@ -664,7 +676,9 @@ function _createClass(Constructor, protoProps, staticProps) {
664
676
  };
665
677
  return BoundingSphere;
666
678
  }();
667
- BoundingSphere._tempVec30 = new Vector3();
679
+ (function() {
680
+ BoundingSphere._tempVec30 = new Vector3();
681
+ })();
668
682
 
669
683
  /**
670
684
  * Axis Aligned Bound Box (AABB).
@@ -823,8 +837,12 @@ BoundingSphere._tempVec30 = new Vector3();
823
837
  };
824
838
  return BoundingBox;
825
839
  }();
826
- BoundingBox._tempVec30 = new Vector3();
827
- BoundingBox._tempVec31 = new Vector3();
840
+ (function() {
841
+ BoundingBox._tempVec30 = new Vector3();
842
+ })();
843
+ (function() {
844
+ BoundingBox._tempVec31 = new Vector3();
845
+ })();
828
846
 
829
847
  /**
830
848
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1217,9 +1235,15 @@ BoundingBox._tempVec31 = new Vector3();
1217
1235
  };
1218
1236
  return CollisionUtil;
1219
1237
  }();
1220
- CollisionUtil._tempVec30 = new Vector3();
1221
- CollisionUtil._tempVec31 = new Vector3();
1222
- CollisionUtil._tempVec32 = new Vector3();
1238
+ (function() {
1239
+ CollisionUtil._tempVec30 = new Vector3();
1240
+ })();
1241
+ (function() {
1242
+ CollisionUtil._tempVec31 = new Vector3();
1243
+ })();
1244
+ (function() {
1245
+ CollisionUtil._tempVec32 = new Vector3();
1246
+ })();
1223
1247
 
1224
1248
  /**
1225
1249
  * Represents a plane in three-dimensional space.
@@ -2543,7 +2567,7 @@ CollisionUtil._tempVec32 = new Vector3();
2543
2567
  out._w = a._w * s;
2544
2568
  out._onValueChanged && out._onValueChanged();
2545
2569
  };
2546
- _createClass(Quaternion, [
2570
+ _create_class(Quaternion, [
2547
2571
  {
2548
2572
  key: "x",
2549
2573
  get: /**
@@ -2603,8 +2627,12 @@ CollisionUtil._tempVec32 = new Vector3();
2603
2627
  ]);
2604
2628
  return Quaternion;
2605
2629
  }();
2606
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2607
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2630
+ (function() {
2631
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2632
+ })();
2633
+ (function() {
2634
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2635
+ })();
2608
2636
 
2609
2637
  /**
2610
2638
  * Represents a 4x4 mathematical matrix.
@@ -3550,11 +3578,21 @@ CollisionUtil._tempVec32 = new Vector3();
3550
3578
  };
3551
3579
  return Matrix;
3552
3580
  }();
3553
- Matrix._tempVec30 = new Vector3();
3554
- Matrix._tempVec31 = new Vector3();
3555
- Matrix._tempVec32 = new Vector3();
3556
- Matrix._tempMat30 = new Matrix3x3();
3557
- /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3581
+ (function() {
3582
+ Matrix._tempVec30 = new Vector3();
3583
+ })();
3584
+ (function() {
3585
+ Matrix._tempVec31 = new Vector3();
3586
+ })();
3587
+ (function() {
3588
+ Matrix._tempVec32 = new Vector3();
3589
+ })();
3590
+ (function() {
3591
+ Matrix._tempMat30 = new Matrix3x3();
3592
+ })();
3593
+ (function() {
3594
+ /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3595
+ })();
3558
3596
 
3559
3597
  /**
3560
3598
  * Represents a ray with an origin and a direction in 3D space.
@@ -3890,7 +3928,7 @@ Matrix._tempMat30 = new Matrix3x3();
3890
3928
  out._y = left._y * s;
3891
3929
  out._onValueChanged && out._onValueChanged();
3892
3930
  };
3893
- _createClass(Vector2, [
3931
+ _create_class(Vector2, [
3894
3932
  {
3895
3933
  key: "x",
3896
3934
  get: /**
@@ -3918,8 +3956,12 @@ Matrix._tempMat30 = new Matrix3x3();
3918
3956
  ]);
3919
3957
  return Vector2;
3920
3958
  }();
3921
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3922
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3959
+ (function() {
3960
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3961
+ })();
3962
+ (function() {
3963
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3964
+ })();
3923
3965
 
3924
3966
  /**
3925
3967
  * Describes a 4D-vector.
@@ -4300,7 +4342,7 @@ Matrix._tempMat30 = new Matrix3x3();
4300
4342
  out._w = w;
4301
4343
  out._onValueChanged && out._onValueChanged();
4302
4344
  };
4303
- _createClass(Vector4, [
4345
+ _create_class(Vector4, [
4304
4346
  {
4305
4347
  key: "x",
4306
4348
  get: /**
@@ -4352,8 +4394,12 @@ Matrix._tempMat30 = new Matrix3x3();
4352
4394
  ]);
4353
4395
  return Vector4;
4354
4396
  }();
4355
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4356
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4397
+ (function() {
4398
+ /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4399
+ })();
4400
+ (function() {
4401
+ /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4402
+ })();
4357
4403
 
4358
4404
  /**
4359
4405
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4563,7 +4609,7 @@ Matrix._tempMat30 = new Matrix3x3();
4563
4609
  out._onValueChanged && out._onValueChanged();
4564
4610
  return out;
4565
4611
  };
4566
- _createClass(Color, [
4612
+ _create_class(Color, [
4567
4613
  {
4568
4614
  key: "r",
4569
4615
  get: /**