@galacean/engine-math 0.9.21 → 0.9.22

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
@@ -2,24 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _create_class = require('@swc/helpers/src/_create_class.mjs');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
10
-
5
+ /**
6
+ * Defines how the bounding volumes intersects or contain one another.
7
+ */ exports.ContainmentType = void 0;
11
8
  (function(ContainmentType) {
12
9
  ContainmentType[ContainmentType[/** Indicates that there is no overlap between two bounding volumes. */ "Disjoint"] = 0] = "Disjoint";
13
10
  ContainmentType[ContainmentType[/** Indicates that one bounding volume completely contains another volume. */ "Contains"] = 1] = "Contains";
14
11
  ContainmentType[ContainmentType[/** Indicates that bounding volumes partially overlap one another. */ "Intersects"] = 2] = "Intersects";
15
12
  })(exports.ContainmentType || (exports.ContainmentType = {}));
16
13
 
14
+ /**
15
+ * Defines the intersection between a plane and a bounding volume.
16
+ */ exports.PlaneIntersectionType = void 0;
17
17
  (function(PlaneIntersectionType) {
18
18
  PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the back of the plane. */ "Back"] = 0] = "Back";
19
19
  PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the front of the plane. */ "Front"] = 1] = "Front";
20
20
  PlaneIntersectionType[PlaneIntersectionType[/** The plane is intersected. */ "Intersecting"] = 2] = "Intersecting";
21
21
  })(exports.PlaneIntersectionType || (exports.PlaneIntersectionType = {}));
22
22
 
23
+ /**
24
+ * Frustum face
25
+ */ exports.FrustumFace = void 0;
23
26
  (function(FrustumFace) {
24
27
  FrustumFace[FrustumFace[/** Near face */ "Near"] = 0] = "Near";
25
28
  FrustumFace[FrustumFace[/** Far face */ "Far"] = 1] = "Far";
@@ -29,6 +32,24 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
29
32
  FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
30
33
  })(exports.FrustumFace || (exports.FrustumFace = {}));
31
34
 
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
+
41
+ if ("value" in descriptor) descriptor.writable = true;
42
+
43
+ Object.defineProperty(target, descriptor.key, descriptor);
44
+ }
45
+ }
46
+ function _create_class(Constructor, protoProps, staticProps) {
47
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
48
+ if (staticProps) _defineProperties(Constructor, staticProps);
49
+
50
+ return Constructor;
51
+ }
52
+
32
53
  /**
33
54
  * Common utility methods for math operations.
34
55
  */ var MathUtil = /*#__PURE__*/ function() {
@@ -74,9 +95,15 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
74
95
  };
75
96
  return MathUtil;
76
97
  }();
77
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
78
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
79
- /** 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
+ })();
80
107
 
81
108
  /**
82
109
  * Describes a 3D-vector.
@@ -535,7 +562,7 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
535
562
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
536
563
  out._onValueChanged && out._onValueChanged();
537
564
  };
538
- _create_class__default['default'](Vector3, [
565
+ _create_class(Vector3, [
539
566
  {
540
567
  key: "x",
541
568
  get: /**
@@ -575,8 +602,12 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
575
602
  ]);
576
603
  return Vector3;
577
604
  }();
578
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
579
- /** @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
+ })();
580
611
 
581
612
  /**
582
613
  * A bounding sphere.
@@ -645,7 +676,9 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
645
676
  };
646
677
  return BoundingSphere;
647
678
  }();
648
- BoundingSphere._tempVec30 = new Vector3();
679
+ (function() {
680
+ BoundingSphere._tempVec30 = new Vector3();
681
+ })();
649
682
 
650
683
  /**
651
684
  * Axis Aligned Bound Box (AABB).
@@ -804,8 +837,12 @@ BoundingSphere._tempVec30 = new Vector3();
804
837
  };
805
838
  return BoundingBox;
806
839
  }();
807
- BoundingBox._tempVec30 = new Vector3();
808
- BoundingBox._tempVec31 = new Vector3();
840
+ (function() {
841
+ BoundingBox._tempVec30 = new Vector3();
842
+ })();
843
+ (function() {
844
+ BoundingBox._tempVec31 = new Vector3();
845
+ })();
809
846
 
810
847
  /**
811
848
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1154,9 +1191,15 @@ BoundingBox._tempVec31 = new Vector3();
1154
1191
  };
1155
1192
  return CollisionUtil;
1156
1193
  }();
1157
- CollisionUtil._tempVec30 = new Vector3();
1158
- CollisionUtil._tempVec31 = new Vector3();
1159
- 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
+ })();
1160
1203
 
1161
1204
  /**
1162
1205
  * Represents a plane in three-dimensional space.
@@ -2480,7 +2523,7 @@ CollisionUtil._tempVec32 = new Vector3();
2480
2523
  out._w = a._w * s;
2481
2524
  out._onValueChanged && out._onValueChanged();
2482
2525
  };
2483
- _create_class__default['default'](Quaternion, [
2526
+ _create_class(Quaternion, [
2484
2527
  {
2485
2528
  key: "x",
2486
2529
  get: /**
@@ -2540,8 +2583,12 @@ CollisionUtil._tempVec32 = new Vector3();
2540
2583
  ]);
2541
2584
  return Quaternion;
2542
2585
  }();
2543
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2544
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2586
+ (function() {
2587
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2588
+ })();
2589
+ (function() {
2590
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2591
+ })();
2545
2592
 
2546
2593
  /**
2547
2594
  * Represents a 4x4 mathematical matrix.
@@ -3487,11 +3534,21 @@ CollisionUtil._tempVec32 = new Vector3();
3487
3534
  };
3488
3535
  return Matrix;
3489
3536
  }();
3490
- Matrix._tempVec30 = new Vector3();
3491
- Matrix._tempVec31 = new Vector3();
3492
- Matrix._tempVec32 = new Vector3();
3493
- Matrix._tempMat30 = new Matrix3x3();
3494
- /** @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
+ })();
3495
3552
 
3496
3553
  /**
3497
3554
  * Represents a ray with an origin and a direction in 3D space.
@@ -3827,7 +3884,7 @@ Matrix._tempMat30 = new Matrix3x3();
3827
3884
  out._y = left._y * s;
3828
3885
  out._onValueChanged && out._onValueChanged();
3829
3886
  };
3830
- _create_class__default['default'](Vector2, [
3887
+ _create_class(Vector2, [
3831
3888
  {
3832
3889
  key: "x",
3833
3890
  get: /**
@@ -3855,8 +3912,12 @@ Matrix._tempMat30 = new Matrix3x3();
3855
3912
  ]);
3856
3913
  return Vector2;
3857
3914
  }();
3858
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3859
- /** @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
+ })();
3860
3921
 
3861
3922
  /**
3862
3923
  * Describes a 4D-vector.
@@ -4237,7 +4298,7 @@ Matrix._tempMat30 = new Matrix3x3();
4237
4298
  out._w = w;
4238
4299
  out._onValueChanged && out._onValueChanged();
4239
4300
  };
4240
- _create_class__default['default'](Vector4, [
4301
+ _create_class(Vector4, [
4241
4302
  {
4242
4303
  key: "x",
4243
4304
  get: /**
@@ -4289,8 +4350,12 @@ Matrix._tempMat30 = new Matrix3x3();
4289
4350
  ]);
4290
4351
  return Vector4;
4291
4352
  }();
4292
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4293
- /** @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
+ })();
4294
4359
 
4295
4360
  /**
4296
4361
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4500,7 +4565,7 @@ Matrix._tempMat30 = new Matrix3x3();
4500
4565
  out._onValueChanged && out._onValueChanged();
4501
4566
  return out;
4502
4567
  };
4503
- _create_class__default['default'](Color, [
4568
+ _create_class(Color, [
4504
4569
  {
4505
4570
  key: "r",
4506
4571
  get: /**