@galacean/engine-math 2.0.0-alpha.6 → 2.0.0-alpha.61
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 +38 -18
- package/dist/main.js.map +1 -1
- package/dist/module.js +38 -18
- package/dist/module.js.map +1 -1
- package/package.json +1 -2
- package/types/BoundingBox.d.ts +1 -3
- package/types/BoundingFrustum.d.ts +3 -3
- package/types/BoundingSphere.d.ts +1 -1
- package/types/Color.d.ts +10 -0
- package/types/Matrix.d.ts +4 -1
- package/types/Matrix3x3.d.ts +2 -1
- package/types/Plane.d.ts +1 -1
- package/types/Quaternion.d.ts +14 -0
- package/types/Ray.d.ts +15 -2
- package/types/Rect.d.ts +10 -0
- package/types/Vector2.d.ts +10 -0
- package/types/Vector3.d.ts +14 -1
- package/types/Vector4.d.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-math",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.61",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/main.js",
|
|
13
13
|
"module": "dist/module.js",
|
|
14
|
-
"browser": "dist/browser.js",
|
|
15
14
|
"debug": "src/index.ts",
|
|
16
15
|
"types": "types/index.d.ts",
|
|
17
16
|
"files": [
|
package/types/BoundingBox.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ import { Vector3, Vector3Like } from "./Vector3";
|
|
|
7
7
|
* Axis Aligned Bound Box (AABB).
|
|
8
8
|
*/
|
|
9
9
|
export declare class BoundingBox implements IClone<BoundingBox>, ICopy<BoundingBox, BoundingBox> {
|
|
10
|
-
private static _tempVec30;
|
|
11
|
-
private static _tempVec31;
|
|
12
10
|
/**
|
|
13
11
|
* Calculate a bounding box from the center point and the extent of the bounding box.
|
|
14
12
|
* @param center - The center point
|
|
@@ -52,7 +50,7 @@ export declare class BoundingBox implements IClone<BoundingBox>, ICopy<BoundingB
|
|
|
52
50
|
* @param min - The minimum point of the box
|
|
53
51
|
* @param max - The maximum point of the box
|
|
54
52
|
*/
|
|
55
|
-
constructor(min?: Vector3, max?: Vector3);
|
|
53
|
+
constructor(min?: Vector3 | null, max?: Vector3 | null);
|
|
56
54
|
/**
|
|
57
55
|
* Get the center point of this bounding box.
|
|
58
56
|
* @param out - The center point of this bounding box
|
|
@@ -25,13 +25,13 @@ export declare class BoundingFrustum implements IClone<BoundingFrustum>, ICopy<B
|
|
|
25
25
|
* Constructor of BoundingFrustum.
|
|
26
26
|
* @param matrix - The view-projection matrix
|
|
27
27
|
*/
|
|
28
|
-
constructor(matrix?: Matrix);
|
|
28
|
+
constructor(matrix?: Matrix | null);
|
|
29
29
|
/**
|
|
30
30
|
* Get the plane by the given frustum face.
|
|
31
31
|
* @param face - The frustum face
|
|
32
|
-
* @returns The plane
|
|
32
|
+
* @returns The plane, or null for an invalid face
|
|
33
33
|
*/
|
|
34
|
-
getPlane(face: FrustumFace): Plane;
|
|
34
|
+
getPlane(face: FrustumFace): Plane | null;
|
|
35
35
|
/**
|
|
36
36
|
* Update all planes from the given matrix.
|
|
37
37
|
* @param matrix - The given view-projection matrix
|
|
@@ -28,7 +28,7 @@ export declare class BoundingSphere implements IClone<BoundingSphere>, ICopy<Bou
|
|
|
28
28
|
* @param center - The center point of the sphere
|
|
29
29
|
* @param radius - The radius of the sphere
|
|
30
30
|
*/
|
|
31
|
-
constructor(center?: Vector3, radius?: number);
|
|
31
|
+
constructor(center?: Vector3 | null, radius?: number);
|
|
32
32
|
/**
|
|
33
33
|
* Creates a clone of this sphere.
|
|
34
34
|
* @returns A clone of this sphere
|
package/types/Color.d.ts
CHANGED
|
@@ -54,6 +54,16 @@ export declare class Color implements IClone<Color>, ICopy<ColorLike, Color> {
|
|
|
54
54
|
* @param out - The result of linear blending between two color
|
|
55
55
|
*/
|
|
56
56
|
static lerp(start: Color, end: Color, t: number, out: Color): Color;
|
|
57
|
+
/** @internal */
|
|
58
|
+
_r: number;
|
|
59
|
+
/** @internal */
|
|
60
|
+
_g: number;
|
|
61
|
+
/** @internal */
|
|
62
|
+
_b: number;
|
|
63
|
+
/** @internal */
|
|
64
|
+
_a: number;
|
|
65
|
+
/** @internal */
|
|
66
|
+
_onValueChanged: (() => void) | null;
|
|
57
67
|
/**
|
|
58
68
|
* The red component of the color, 0~1.
|
|
59
69
|
*/
|
package/types/Matrix.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class Matrix implements IClone<Matrix>, ICopy<Matrix, Matrix> {
|
|
|
10
10
|
private static readonly _tempVec31;
|
|
11
11
|
private static readonly _tempVec32;
|
|
12
12
|
private static readonly _tempMat30;
|
|
13
|
+
/** @internal Identity matrix. */
|
|
14
|
+
static readonly _identity: Matrix;
|
|
13
15
|
/**
|
|
14
16
|
* Determines the product of two matrices.
|
|
15
17
|
* @param left - The first matrix to multiply
|
|
@@ -90,8 +92,9 @@ export declare class Matrix implements IClone<Matrix>, ICopy<Matrix, Matrix> {
|
|
|
90
92
|
* Calculate the inverse of the specified matrix.
|
|
91
93
|
* @param a - The matrix whose inverse is to be calculated
|
|
92
94
|
* @param out - The inverse of the specified matrix
|
|
95
|
+
* @returns Null if the matrix is singular; otherwise undefined
|
|
93
96
|
*/
|
|
94
|
-
static invert(a: Matrix, out: Matrix): void;
|
|
97
|
+
static invert(a: Matrix, out: Matrix): void | null;
|
|
95
98
|
/**
|
|
96
99
|
* Calculate a right-handed look-at matrix.
|
|
97
100
|
* @param eye - The position of the viewer's eye
|
package/types/Matrix3x3.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare class Matrix3x3 implements IClone<Matrix3x3>, ICopy<Matrix3x3, Ma
|
|
|
65
65
|
* Calculate the inverse of the specified matrix.
|
|
66
66
|
* @param a - The matrix whose inverse is to be calculated
|
|
67
67
|
* @param out - The inverse of the specified matrix
|
|
68
|
+
* @returns Null if the matrix is singular; otherwise undefined
|
|
68
69
|
*/
|
|
69
70
|
static invert(a: Matrix3x3, out: Matrix3x3): void;
|
|
70
71
|
/**
|
|
@@ -73,7 +74,7 @@ export declare class Matrix3x3 implements IClone<Matrix3x3>, ICopy<Matrix3x3, Ma
|
|
|
73
74
|
* @param mat4 - The 4x4 matrix
|
|
74
75
|
* @param out - THe 3x3 normal matrix
|
|
75
76
|
*/
|
|
76
|
-
static normalMatrix(mat4: Matrix, out: Matrix3x3): void;
|
|
77
|
+
static normalMatrix(mat4: Matrix, out: Matrix3x3): void | null;
|
|
77
78
|
/**
|
|
78
79
|
* The specified matrix rotates around an angle.
|
|
79
80
|
* @param a - The specified matrix
|
package/types/Plane.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class Plane implements IClone<Plane>, ICopy<Plane, Plane> {
|
|
|
28
28
|
* @param normal - The normal vector
|
|
29
29
|
* @param distance - The distance of the plane along its normal to the origin
|
|
30
30
|
*/
|
|
31
|
-
constructor(normal?: Vector3, distance?: number);
|
|
31
|
+
constructor(normal?: Vector3 | null, distance?: number);
|
|
32
32
|
/**
|
|
33
33
|
* Normalize the normal vector of this plane.
|
|
34
34
|
* @returns The plane after normalize
|
package/types/Quaternion.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { Vector3 } from "./Vector3";
|
|
|
6
6
|
* Represents a four dimensional mathematical quaternion.
|
|
7
7
|
*/
|
|
8
8
|
export declare class Quaternion implements IClone<Quaternion>, ICopy<QuaternionLike, Quaternion> {
|
|
9
|
+
/** @internal */
|
|
10
|
+
static readonly _tempVector3: Vector3;
|
|
11
|
+
/** @internal */
|
|
12
|
+
static readonly _tempQuat1: Quaternion;
|
|
9
13
|
/**
|
|
10
14
|
* Determines the sum of two quaternions.
|
|
11
15
|
* @param left - The first quaternion to add
|
|
@@ -143,6 +147,16 @@ export declare class Quaternion implements IClone<Quaternion>, ICopy<QuaternionL
|
|
|
143
147
|
* @param out - The scaled quaternion
|
|
144
148
|
*/
|
|
145
149
|
static scale(a: Quaternion, s: number, out: Quaternion): void;
|
|
150
|
+
/** @internal */
|
|
151
|
+
_x: number;
|
|
152
|
+
/** @internal */
|
|
153
|
+
_y: number;
|
|
154
|
+
/** @internal */
|
|
155
|
+
_z: number;
|
|
156
|
+
/** @internal */
|
|
157
|
+
_w: number;
|
|
158
|
+
/** @internal */
|
|
159
|
+
_onValueChanged: (() => void) | null;
|
|
146
160
|
/**
|
|
147
161
|
* The x component of the quaternion.
|
|
148
162
|
*/
|
package/types/Ray.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BoundingBox } from "./BoundingBox";
|
|
2
2
|
import { BoundingSphere } from "./BoundingSphere";
|
|
3
|
+
import { IClone } from "./IClone";
|
|
4
|
+
import { ICopy } from "./ICopy";
|
|
3
5
|
import { Plane } from "./Plane";
|
|
4
6
|
import { Vector3 } from "./Vector3";
|
|
5
7
|
/**
|
|
6
8
|
* Represents a ray with an origin and a direction in 3D space.
|
|
7
9
|
*/
|
|
8
|
-
export declare class Ray {
|
|
10
|
+
export declare class Ray implements IClone<Ray>, ICopy<Ray, Ray> {
|
|
9
11
|
/** The origin of the ray. */
|
|
10
12
|
readonly origin: Vector3;
|
|
11
13
|
/** The normalized direction of the ray. */
|
|
@@ -15,7 +17,7 @@ export declare class Ray {
|
|
|
15
17
|
* @param origin - The origin vector
|
|
16
18
|
* @param direction - The direction vector
|
|
17
19
|
*/
|
|
18
|
-
constructor(origin?: Vector3, direction?: Vector3);
|
|
20
|
+
constructor(origin?: Vector3 | null, direction?: Vector3 | null);
|
|
19
21
|
/**
|
|
20
22
|
* Check if this ray intersects the specified plane.
|
|
21
23
|
* @param plane - The specified plane
|
|
@@ -41,4 +43,15 @@ export declare class Ray {
|
|
|
41
43
|
* @returns The out
|
|
42
44
|
*/
|
|
43
45
|
getPoint(distance: number, out: Vector3): Vector3;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a clone of this ray.
|
|
48
|
+
* @returns A clone of this ray
|
|
49
|
+
*/
|
|
50
|
+
clone(): Ray;
|
|
51
|
+
/**
|
|
52
|
+
* Copy this ray from the specified ray.
|
|
53
|
+
* @param source - The specified ray
|
|
54
|
+
* @returns This ray
|
|
55
|
+
*/
|
|
56
|
+
copyFrom(source: Ray): Ray;
|
|
44
57
|
}
|
package/types/Rect.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { IClone } from "./IClone";
|
|
2
2
|
import { ICopy } from "./ICopy";
|
|
3
3
|
export declare class Rect implements IClone<Rect>, ICopy<Rect, Rect> {
|
|
4
|
+
/** @internal */
|
|
5
|
+
_x: number;
|
|
6
|
+
/** @internal */
|
|
7
|
+
_y: number;
|
|
8
|
+
/** @internal */
|
|
9
|
+
_width: number;
|
|
10
|
+
/** @internal */
|
|
11
|
+
_height: number;
|
|
12
|
+
/** @internal */
|
|
13
|
+
_onValueChanged: (() => void) | null;
|
|
4
14
|
/**
|
|
5
15
|
* The x coordinate of the rectangle.
|
|
6
16
|
*/
|
package/types/Vector2.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { ICopy } from "./ICopy";
|
|
|
4
4
|
* Describes a 2D-vector.
|
|
5
5
|
*/
|
|
6
6
|
export declare class Vector2 implements IClone<Vector2>, ICopy<Vector2Like, Vector2> {
|
|
7
|
+
/** @internal */
|
|
8
|
+
static readonly _zero: Vector2;
|
|
9
|
+
/** @internal */
|
|
10
|
+
static readonly _one: Vector2;
|
|
7
11
|
/**
|
|
8
12
|
* Determines the sum of two vectors.
|
|
9
13
|
* @param left - The first vector to add
|
|
@@ -101,6 +105,12 @@ export declare class Vector2 implements IClone<Vector2>, ICopy<Vector2Like, Vect
|
|
|
101
105
|
* @param out - The scaled vector
|
|
102
106
|
*/
|
|
103
107
|
static scale(left: Vector2, s: number, out: Vector2): void;
|
|
108
|
+
/** @internal */
|
|
109
|
+
_x: number;
|
|
110
|
+
/** @internal */
|
|
111
|
+
_y: number;
|
|
112
|
+
/** @internal */
|
|
113
|
+
_onValueChanged: (() => void) | null;
|
|
104
114
|
/**
|
|
105
115
|
* The x component of the vector.
|
|
106
116
|
*/
|
package/types/Vector3.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ import { Vector4 } from "./Vector4";
|
|
|
7
7
|
* Describes a 3D-vector.
|
|
8
8
|
*/
|
|
9
9
|
export declare class Vector3 implements IClone<Vector3>, ICopy<Vector3Like, Vector3> {
|
|
10
|
+
/** @internal */
|
|
11
|
+
static readonly _zero: Vector3;
|
|
12
|
+
/** @internal */
|
|
13
|
+
static readonly _one: Vector3;
|
|
10
14
|
/**
|
|
11
15
|
* Determines the sum of two vectors.
|
|
12
16
|
* @param left - The first vector to add
|
|
@@ -102,8 +106,9 @@ export declare class Vector3 implements IClone<Vector3>, ICopy<Vector3Like, Vect
|
|
|
102
106
|
* Converts the vector into a unit vector.
|
|
103
107
|
* @param a - The vector to normalize
|
|
104
108
|
* @param out - The normalized vector
|
|
109
|
+
* @returns True if the vector has a unit form, otherwise false and `out` is left untouched
|
|
105
110
|
*/
|
|
106
|
-
static normalize(a: Vector3, out: Vector3):
|
|
111
|
+
static normalize(a: Vector3, out: Vector3): boolean;
|
|
107
112
|
/**
|
|
108
113
|
* Scale a vector by the given value.
|
|
109
114
|
* @param a - The vector to scale
|
|
@@ -159,6 +164,14 @@ export declare class Vector3 implements IClone<Vector3>, ICopy<Vector3Like, Vect
|
|
|
159
164
|
* @param out - The transformed vector
|
|
160
165
|
*/
|
|
161
166
|
static transformByQuat(v: Vector3, quaternion: Quaternion, out: Vector3): void;
|
|
167
|
+
/** @internal */
|
|
168
|
+
_x: number;
|
|
169
|
+
/** @internal */
|
|
170
|
+
_y: number;
|
|
171
|
+
/** @internal */
|
|
172
|
+
_z: number;
|
|
173
|
+
/** @internal */
|
|
174
|
+
_onValueChanged: (() => void) | null;
|
|
162
175
|
/**
|
|
163
176
|
* The x component of the vector.
|
|
164
177
|
*/
|
package/types/Vector4.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { Quaternion } from "./Quaternion";
|
|
|
6
6
|
* Describes a 4D-vector.
|
|
7
7
|
*/
|
|
8
8
|
export declare class Vector4 implements IClone<Vector4>, ICopy<Vector4Like, Vector4> {
|
|
9
|
+
/** @internal */
|
|
10
|
+
static readonly _zero: Vector4;
|
|
11
|
+
/** @internal */
|
|
12
|
+
static readonly _one: Vector4;
|
|
9
13
|
/**
|
|
10
14
|
* Determines the sum of two vectors.
|
|
11
15
|
* @param left - The first vector to add
|
|
@@ -117,6 +121,16 @@ export declare class Vector4 implements IClone<Vector4>, ICopy<Vector4Like, Vect
|
|
|
117
121
|
* @param out - The transformed vector
|
|
118
122
|
*/
|
|
119
123
|
static transformByQuat(v: Vector4, q: Quaternion, out: Vector4): void;
|
|
124
|
+
/** @internal */
|
|
125
|
+
_x: number;
|
|
126
|
+
/** @internal */
|
|
127
|
+
_y: number;
|
|
128
|
+
/** @internal */
|
|
129
|
+
_z: number;
|
|
130
|
+
/** @internal */
|
|
131
|
+
_w: number;
|
|
132
|
+
/** @internal */
|
|
133
|
+
_onValueChanged: (() => void) | null;
|
|
120
134
|
/**
|
|
121
135
|
* The x component of the vector.
|
|
122
136
|
*/
|