@galacean/engine-math 0.9.0-beta.81 → 0.9.0

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.
@@ -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.
@@ -1173,9 +1191,15 @@ BoundingBox._tempVec31 = new Vector3();
1173
1191
  };
1174
1192
  return CollisionUtil;
1175
1193
  }();
1176
- CollisionUtil._tempVec30 = new Vector3();
1177
- CollisionUtil._tempVec31 = new Vector3();
1178
- CollisionUtil._tempVec32 = new Vector3();
1194
+ (function() {
1195
+ CollisionUtil._tempVec30 = new Vector3();
1196
+ })();
1197
+ (function() {
1198
+ CollisionUtil._tempVec31 = new Vector3();
1199
+ })();
1200
+ (function() {
1201
+ CollisionUtil._tempVec32 = new Vector3();
1202
+ })();
1179
1203
 
1180
1204
  /**
1181
1205
  * Represents a plane in three-dimensional space.
@@ -2499,7 +2523,7 @@ CollisionUtil._tempVec32 = new Vector3();
2499
2523
  out._w = a._w * s;
2500
2524
  out._onValueChanged && out._onValueChanged();
2501
2525
  };
2502
- _createClass(Quaternion, [
2526
+ _create_class(Quaternion, [
2503
2527
  {
2504
2528
  key: "x",
2505
2529
  get: /**
@@ -2559,8 +2583,12 @@ CollisionUtil._tempVec32 = new Vector3();
2559
2583
  ]);
2560
2584
  return Quaternion;
2561
2585
  }();
2562
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2563
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2586
+ (function() {
2587
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2588
+ })();
2589
+ (function() {
2590
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2591
+ })();
2564
2592
 
2565
2593
  /**
2566
2594
  * Represents a 4x4 mathematical matrix.
@@ -3506,11 +3534,21 @@ CollisionUtil._tempVec32 = new Vector3();
3506
3534
  };
3507
3535
  return Matrix;
3508
3536
  }();
3509
- Matrix._tempVec30 = new Vector3();
3510
- Matrix._tempVec31 = new Vector3();
3511
- Matrix._tempVec32 = new Vector3();
3512
- Matrix._tempMat30 = new Matrix3x3();
3513
- /** @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);
3537
+ (function() {
3538
+ Matrix._tempVec30 = new Vector3();
3539
+ })();
3540
+ (function() {
3541
+ Matrix._tempVec31 = new Vector3();
3542
+ })();
3543
+ (function() {
3544
+ Matrix._tempVec32 = new Vector3();
3545
+ })();
3546
+ (function() {
3547
+ Matrix._tempMat30 = new Matrix3x3();
3548
+ })();
3549
+ (function() {
3550
+ /** @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);
3551
+ })();
3514
3552
 
3515
3553
  /**
3516
3554
  * Represents a ray with an origin and a direction in 3D space.
@@ -3846,7 +3884,7 @@ Matrix._tempMat30 = new Matrix3x3();
3846
3884
  out._y = left._y * s;
3847
3885
  out._onValueChanged && out._onValueChanged();
3848
3886
  };
3849
- _createClass(Vector2, [
3887
+ _create_class(Vector2, [
3850
3888
  {
3851
3889
  key: "x",
3852
3890
  get: /**
@@ -3874,8 +3912,12 @@ Matrix._tempMat30 = new Matrix3x3();
3874
3912
  ]);
3875
3913
  return Vector2;
3876
3914
  }();
3877
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3878
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3915
+ (function() {
3916
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3917
+ })();
3918
+ (function() {
3919
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3920
+ })();
3879
3921
 
3880
3922
  /**
3881
3923
  * Describes a 4D-vector.
@@ -4256,7 +4298,7 @@ Matrix._tempMat30 = new Matrix3x3();
4256
4298
  out._w = w;
4257
4299
  out._onValueChanged && out._onValueChanged();
4258
4300
  };
4259
- _createClass(Vector4, [
4301
+ _create_class(Vector4, [
4260
4302
  {
4261
4303
  key: "x",
4262
4304
  get: /**
@@ -4308,8 +4350,12 @@ Matrix._tempMat30 = new Matrix3x3();
4308
4350
  ]);
4309
4351
  return Vector4;
4310
4352
  }();
4311
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4312
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4353
+ (function() {
4354
+ /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4355
+ })();
4356
+ (function() {
4357
+ /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4358
+ })();
4313
4359
 
4314
4360
  /**
4315
4361
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4519,7 +4565,7 @@ Matrix._tempMat30 = new Matrix3x3();
4519
4565
  out._onValueChanged && out._onValueChanged();
4520
4566
  return out;
4521
4567
  };
4522
- _createClass(Color, [
4568
+ _create_class(Color, [
4523
4569
  {
4524
4570
  key: "r",
4525
4571
  get: /**
package/dist/module.js CHANGED
@@ -29,19 +29,21 @@
29
29
  })(FrustumFace || (FrustumFace = {}));
30
30
 
31
31
  function _defineProperties(target, props) {
32
- for (var i = 0; i < props.length; i++) {
33
- var descriptor = props[i];
34
- descriptor.enumerable = descriptor.enumerable || false;
35
- descriptor.configurable = true;
36
- if ("value" in descriptor) descriptor.writable = true;
37
- Object.defineProperty(target, descriptor.key, descriptor);
38
- }
32
+ for (var i = 0; i < props.length; i++) {
33
+ var descriptor = props[i];
34
+ descriptor.enumerable = descriptor.enumerable || false;
35
+ descriptor.configurable = true;
36
+
37
+ if ("value" in descriptor) descriptor.writable = true;
38
+
39
+ Object.defineProperty(target, descriptor.key, descriptor);
40
+ }
39
41
  }
42
+ function _create_class(Constructor, protoProps, staticProps) {
43
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
44
+ if (staticProps) _defineProperties(Constructor, staticProps);
40
45
 
41
- function _createClass(Constructor, protoProps, staticProps) {
42
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
43
- if (staticProps) _defineProperties(Constructor, staticProps);
44
- return Constructor;
46
+ return Constructor;
45
47
  }
46
48
 
47
49
  /**
@@ -89,9 +91,15 @@ function _createClass(Constructor, protoProps, staticProps) {
89
91
  };
90
92
  return MathUtil;
91
93
  }();
92
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
93
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
94
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
94
+ (function() {
95
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
96
+ })();
97
+ (function() {
98
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
99
+ })();
100
+ (function() {
101
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
102
+ })();
95
103
 
96
104
  /**
97
105
  * Describes a 3D-vector.
@@ -550,7 +558,7 @@ function _createClass(Constructor, protoProps, staticProps) {
550
558
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
551
559
  out._onValueChanged && out._onValueChanged();
552
560
  };
553
- _createClass(Vector3, [
561
+ _create_class(Vector3, [
554
562
  {
555
563
  key: "x",
556
564
  get: /**
@@ -590,8 +598,12 @@ function _createClass(Constructor, protoProps, staticProps) {
590
598
  ]);
591
599
  return Vector3;
592
600
  }();
593
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
594
- /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
601
+ (function() {
602
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
603
+ })();
604
+ (function() {
605
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
606
+ })();
595
607
 
596
608
  /**
597
609
  * A bounding sphere.
@@ -660,7 +672,9 @@ function _createClass(Constructor, protoProps, staticProps) {
660
672
  };
661
673
  return BoundingSphere;
662
674
  }();
663
- BoundingSphere._tempVec30 = new Vector3();
675
+ (function() {
676
+ BoundingSphere._tempVec30 = new Vector3();
677
+ })();
664
678
 
665
679
  /**
666
680
  * Axis Aligned Bound Box (AABB).
@@ -819,8 +833,12 @@ BoundingSphere._tempVec30 = new Vector3();
819
833
  };
820
834
  return BoundingBox;
821
835
  }();
822
- BoundingBox._tempVec30 = new Vector3();
823
- BoundingBox._tempVec31 = new Vector3();
836
+ (function() {
837
+ BoundingBox._tempVec30 = new Vector3();
838
+ })();
839
+ (function() {
840
+ BoundingBox._tempVec31 = new Vector3();
841
+ })();
824
842
 
825
843
  /**
826
844
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1169,9 +1187,15 @@ BoundingBox._tempVec31 = new Vector3();
1169
1187
  };
1170
1188
  return CollisionUtil;
1171
1189
  }();
1172
- CollisionUtil._tempVec30 = new Vector3();
1173
- CollisionUtil._tempVec31 = new Vector3();
1174
- CollisionUtil._tempVec32 = new Vector3();
1190
+ (function() {
1191
+ CollisionUtil._tempVec30 = new Vector3();
1192
+ })();
1193
+ (function() {
1194
+ CollisionUtil._tempVec31 = new Vector3();
1195
+ })();
1196
+ (function() {
1197
+ CollisionUtil._tempVec32 = new Vector3();
1198
+ })();
1175
1199
 
1176
1200
  /**
1177
1201
  * Represents a plane in three-dimensional space.
@@ -2495,7 +2519,7 @@ CollisionUtil._tempVec32 = new Vector3();
2495
2519
  out._w = a._w * s;
2496
2520
  out._onValueChanged && out._onValueChanged();
2497
2521
  };
2498
- _createClass(Quaternion, [
2522
+ _create_class(Quaternion, [
2499
2523
  {
2500
2524
  key: "x",
2501
2525
  get: /**
@@ -2555,8 +2579,12 @@ CollisionUtil._tempVec32 = new Vector3();
2555
2579
  ]);
2556
2580
  return Quaternion;
2557
2581
  }();
2558
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2559
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2582
+ (function() {
2583
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2584
+ })();
2585
+ (function() {
2586
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2587
+ })();
2560
2588
 
2561
2589
  /**
2562
2590
  * Represents a 4x4 mathematical matrix.
@@ -3502,11 +3530,21 @@ CollisionUtil._tempVec32 = new Vector3();
3502
3530
  };
3503
3531
  return Matrix;
3504
3532
  }();
3505
- Matrix._tempVec30 = new Vector3();
3506
- Matrix._tempVec31 = new Vector3();
3507
- Matrix._tempVec32 = new Vector3();
3508
- Matrix._tempMat30 = new Matrix3x3();
3509
- /** @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);
3533
+ (function() {
3534
+ Matrix._tempVec30 = new Vector3();
3535
+ })();
3536
+ (function() {
3537
+ Matrix._tempVec31 = new Vector3();
3538
+ })();
3539
+ (function() {
3540
+ Matrix._tempVec32 = new Vector3();
3541
+ })();
3542
+ (function() {
3543
+ Matrix._tempMat30 = new Matrix3x3();
3544
+ })();
3545
+ (function() {
3546
+ /** @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);
3547
+ })();
3510
3548
 
3511
3549
  /**
3512
3550
  * Represents a ray with an origin and a direction in 3D space.
@@ -3842,7 +3880,7 @@ Matrix._tempMat30 = new Matrix3x3();
3842
3880
  out._y = left._y * s;
3843
3881
  out._onValueChanged && out._onValueChanged();
3844
3882
  };
3845
- _createClass(Vector2, [
3883
+ _create_class(Vector2, [
3846
3884
  {
3847
3885
  key: "x",
3848
3886
  get: /**
@@ -3870,8 +3908,12 @@ Matrix._tempMat30 = new Matrix3x3();
3870
3908
  ]);
3871
3909
  return Vector2;
3872
3910
  }();
3873
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3874
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3911
+ (function() {
3912
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3913
+ })();
3914
+ (function() {
3915
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3916
+ })();
3875
3917
 
3876
3918
  /**
3877
3919
  * Describes a 4D-vector.
@@ -4252,7 +4294,7 @@ Matrix._tempMat30 = new Matrix3x3();
4252
4294
  out._w = w;
4253
4295
  out._onValueChanged && out._onValueChanged();
4254
4296
  };
4255
- _createClass(Vector4, [
4297
+ _create_class(Vector4, [
4256
4298
  {
4257
4299
  key: "x",
4258
4300
  get: /**
@@ -4304,8 +4346,12 @@ Matrix._tempMat30 = new Matrix3x3();
4304
4346
  ]);
4305
4347
  return Vector4;
4306
4348
  }();
4307
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4308
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4349
+ (function() {
4350
+ /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4351
+ })();
4352
+ (function() {
4353
+ /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4354
+ })();
4309
4355
 
4310
4356
  /**
4311
4357
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4515,7 +4561,7 @@ Matrix._tempMat30 = new Matrix3x3();
4515
4561
  out._onValueChanged && out._onValueChanged();
4516
4562
  return out;
4517
4563
  };
4518
- _createClass(Color, [
4564
+ _create_class(Color, [
4519
4565
  {
4520
4566
  key: "r",
4521
4567
  get: /**