@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 +84 -38
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +84 -38
- package/dist/module.js +84 -38
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser.js +0 -4863
- package/dist/browser.min.js +0 -1
package/dist/miniprogram.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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
97
|
-
/** The
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
598
|
-
/** @internal */ Vector3.
|
|
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
|
-
|
|
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
|
-
|
|
827
|
-
BoundingBox.
|
|
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
|
-
|
|
1221
|
-
CollisionUtil.
|
|
1222
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2607
|
-
/** @internal */ 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
|
-
|
|
3554
|
-
Matrix.
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3922
|
-
/** @internal */ Vector2.
|
|
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
|
-
|
|
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
|
-
|
|
4356
|
-
/** @internal */ Vector4.
|
|
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
|
-
|
|
4612
|
+
_create_class(Color, [
|
|
4567
4613
|
{
|
|
4568
4614
|
key: "r",
|
|
4569
4615
|
get: /**
|
package/dist/module.js
CHANGED
|
@@ -29,19 +29,21 @@
|
|
|
29
29
|
})(FrustumFace || (FrustumFace = {}));
|
|
30
30
|
|
|
31
31
|
function _defineProperties(target, props) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
/** The
|
|
94
|
-
|
|
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
|
-
|
|
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
|
-
|
|
594
|
-
/** @internal */ Vector3.
|
|
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
|
-
|
|
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
|
-
|
|
823
|
-
BoundingBox.
|
|
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.
|
|
@@ -1213,9 +1231,15 @@ BoundingBox._tempVec31 = new Vector3();
|
|
|
1213
1231
|
};
|
|
1214
1232
|
return CollisionUtil;
|
|
1215
1233
|
}();
|
|
1216
|
-
|
|
1217
|
-
CollisionUtil.
|
|
1218
|
-
|
|
1234
|
+
(function() {
|
|
1235
|
+
CollisionUtil._tempVec30 = new Vector3();
|
|
1236
|
+
})();
|
|
1237
|
+
(function() {
|
|
1238
|
+
CollisionUtil._tempVec31 = new Vector3();
|
|
1239
|
+
})();
|
|
1240
|
+
(function() {
|
|
1241
|
+
CollisionUtil._tempVec32 = new Vector3();
|
|
1242
|
+
})();
|
|
1219
1243
|
|
|
1220
1244
|
/**
|
|
1221
1245
|
* Represents a plane in three-dimensional space.
|
|
@@ -2539,7 +2563,7 @@ CollisionUtil._tempVec32 = new Vector3();
|
|
|
2539
2563
|
out._w = a._w * s;
|
|
2540
2564
|
out._onValueChanged && out._onValueChanged();
|
|
2541
2565
|
};
|
|
2542
|
-
|
|
2566
|
+
_create_class(Quaternion, [
|
|
2543
2567
|
{
|
|
2544
2568
|
key: "x",
|
|
2545
2569
|
get: /**
|
|
@@ -2599,8 +2623,12 @@ CollisionUtil._tempVec32 = new Vector3();
|
|
|
2599
2623
|
]);
|
|
2600
2624
|
return Quaternion;
|
|
2601
2625
|
}();
|
|
2602
|
-
|
|
2603
|
-
/** @internal */ Quaternion.
|
|
2626
|
+
(function() {
|
|
2627
|
+
/** @internal */ Quaternion._tempVector3 = new Vector3();
|
|
2628
|
+
})();
|
|
2629
|
+
(function() {
|
|
2630
|
+
/** @internal */ Quaternion._tempQuat1 = new Quaternion();
|
|
2631
|
+
})();
|
|
2604
2632
|
|
|
2605
2633
|
/**
|
|
2606
2634
|
* Represents a 4x4 mathematical matrix.
|
|
@@ -3546,11 +3574,21 @@ CollisionUtil._tempVec32 = new Vector3();
|
|
|
3546
3574
|
};
|
|
3547
3575
|
return Matrix;
|
|
3548
3576
|
}();
|
|
3549
|
-
|
|
3550
|
-
Matrix.
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3577
|
+
(function() {
|
|
3578
|
+
Matrix._tempVec30 = new Vector3();
|
|
3579
|
+
})();
|
|
3580
|
+
(function() {
|
|
3581
|
+
Matrix._tempVec31 = new Vector3();
|
|
3582
|
+
})();
|
|
3583
|
+
(function() {
|
|
3584
|
+
Matrix._tempVec32 = new Vector3();
|
|
3585
|
+
})();
|
|
3586
|
+
(function() {
|
|
3587
|
+
Matrix._tempMat30 = new Matrix3x3();
|
|
3588
|
+
})();
|
|
3589
|
+
(function() {
|
|
3590
|
+
/** @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);
|
|
3591
|
+
})();
|
|
3554
3592
|
|
|
3555
3593
|
/**
|
|
3556
3594
|
* Represents a ray with an origin and a direction in 3D space.
|
|
@@ -3886,7 +3924,7 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
3886
3924
|
out._y = left._y * s;
|
|
3887
3925
|
out._onValueChanged && out._onValueChanged();
|
|
3888
3926
|
};
|
|
3889
|
-
|
|
3927
|
+
_create_class(Vector2, [
|
|
3890
3928
|
{
|
|
3891
3929
|
key: "x",
|
|
3892
3930
|
get: /**
|
|
@@ -3914,8 +3952,12 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
3914
3952
|
]);
|
|
3915
3953
|
return Vector2;
|
|
3916
3954
|
}();
|
|
3917
|
-
|
|
3918
|
-
/** @internal */ Vector2.
|
|
3955
|
+
(function() {
|
|
3956
|
+
/** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
|
|
3957
|
+
})();
|
|
3958
|
+
(function() {
|
|
3959
|
+
/** @internal */ Vector2._one = new Vector2(1.0, 1.0);
|
|
3960
|
+
})();
|
|
3919
3961
|
|
|
3920
3962
|
/**
|
|
3921
3963
|
* Describes a 4D-vector.
|
|
@@ -4296,7 +4338,7 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4296
4338
|
out._w = w;
|
|
4297
4339
|
out._onValueChanged && out._onValueChanged();
|
|
4298
4340
|
};
|
|
4299
|
-
|
|
4341
|
+
_create_class(Vector4, [
|
|
4300
4342
|
{
|
|
4301
4343
|
key: "x",
|
|
4302
4344
|
get: /**
|
|
@@ -4348,8 +4390,12 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4348
4390
|
]);
|
|
4349
4391
|
return Vector4;
|
|
4350
4392
|
}();
|
|
4351
|
-
|
|
4352
|
-
/** @internal */ Vector4.
|
|
4393
|
+
(function() {
|
|
4394
|
+
/** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
4395
|
+
})();
|
|
4396
|
+
(function() {
|
|
4397
|
+
/** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
4398
|
+
})();
|
|
4353
4399
|
|
|
4354
4400
|
/**
|
|
4355
4401
|
* Describes a color in the from of RGBA (in order: R, G, B, A).
|
|
@@ -4559,7 +4605,7 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4559
4605
|
out._onValueChanged && out._onValueChanged();
|
|
4560
4606
|
return out;
|
|
4561
4607
|
};
|
|
4562
|
-
|
|
4608
|
+
_create_class(Color, [
|
|
4563
4609
|
{
|
|
4564
4610
|
key: "r",
|
|
4565
4611
|
get: /**
|