@esengine/ecs-framework-math 1.0.5 → 2.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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/bin/Animation/Easing.d.ts +244 -0
  3. package/bin/Animation/Easing.d.ts.map +1 -0
  4. package/bin/Animation/Easing.js +407 -0
  5. package/bin/Animation/Easing.js.map +1 -0
  6. package/bin/Animation/Interpolation.d.ts +172 -0
  7. package/bin/Animation/Interpolation.d.ts.map +1 -0
  8. package/bin/Animation/Interpolation.js +327 -0
  9. package/bin/Animation/Interpolation.js.map +1 -0
  10. package/bin/Animation/index.d.ts +8 -0
  11. package/bin/Animation/index.d.ts.map +1 -0
  12. package/bin/Animation/index.js +8 -0
  13. package/bin/Animation/index.js.map +1 -0
  14. package/bin/Circle.d.ts +277 -0
  15. package/bin/Circle.d.ts.map +1 -0
  16. package/bin/Circle.js +496 -0
  17. package/bin/Circle.js.map +1 -0
  18. package/bin/Collision/CollisionDetector.d.ts +114 -0
  19. package/bin/Collision/CollisionDetector.d.ts.map +1 -0
  20. package/bin/Collision/CollisionDetector.js +353 -0
  21. package/bin/Collision/CollisionDetector.js.map +1 -0
  22. package/bin/Collision/index.d.ts +7 -0
  23. package/bin/Collision/index.d.ts.map +1 -0
  24. package/bin/Collision/index.js +7 -0
  25. package/bin/Collision/index.js.map +1 -0
  26. package/bin/Color.d.ts +277 -0
  27. package/bin/Color.d.ts.map +1 -0
  28. package/bin/Color.js +470 -0
  29. package/bin/Color.js.map +1 -0
  30. package/bin/Fixed32.d.ts +266 -0
  31. package/bin/Fixed32.d.ts.map +1 -0
  32. package/bin/Fixed32.js +381 -0
  33. package/bin/Fixed32.js.map +1 -0
  34. package/bin/FixedMath.d.ts +109 -0
  35. package/bin/FixedMath.d.ts.map +1 -0
  36. package/bin/FixedMath.js +264 -0
  37. package/bin/FixedMath.js.map +1 -0
  38. package/bin/FixedVector2.d.ts +293 -0
  39. package/bin/FixedVector2.d.ts.map +1 -0
  40. package/bin/FixedVector2.js +413 -0
  41. package/bin/FixedVector2.js.map +1 -0
  42. package/bin/MathUtils.d.ts +312 -0
  43. package/bin/MathUtils.d.ts.map +1 -0
  44. package/bin/MathUtils.js +500 -0
  45. package/bin/MathUtils.js.map +1 -0
  46. package/bin/Matrix3.d.ts +288 -0
  47. package/bin/Matrix3.d.ts.map +1 -0
  48. package/bin/Matrix3.js +542 -0
  49. package/bin/Matrix3.js.map +1 -0
  50. package/bin/Rectangle.d.ts +266 -0
  51. package/bin/Rectangle.d.ts.map +1 -0
  52. package/bin/Rectangle.js +437 -0
  53. package/bin/Rectangle.js.map +1 -0
  54. package/bin/Vector2.d.ts +333 -0
  55. package/bin/Vector2.d.ts.map +1 -0
  56. package/bin/Vector2.js +484 -0
  57. package/bin/Vector2.js.map +1 -0
  58. package/bin/Vector3.d.ts +257 -0
  59. package/bin/Vector3.d.ts.map +1 -0
  60. package/bin/Vector3.js +372 -0
  61. package/bin/Vector3.js.map +1 -0
  62. package/bin/index.d.ts +25 -0
  63. package/bin/index.d.ts.map +1 -0
  64. package/bin/index.js +32 -0
  65. package/bin/index.js.map +1 -0
  66. package/bin/nodes/ColorNodes.d.ts +70 -0
  67. package/bin/nodes/ColorNodes.d.ts.map +1 -0
  68. package/bin/nodes/ColorNodes.js +427 -0
  69. package/bin/nodes/ColorNodes.js.map +1 -0
  70. package/bin/nodes/FixedNodes.d.ts +98 -0
  71. package/bin/nodes/FixedNodes.d.ts.map +1 -0
  72. package/bin/nodes/FixedNodes.js +612 -0
  73. package/bin/nodes/FixedNodes.js.map +1 -0
  74. package/bin/nodes/FixedVectorNodes.d.ts +58 -0
  75. package/bin/nodes/FixedVectorNodes.d.ts.map +1 -0
  76. package/bin/nodes/FixedVectorNodes.js +330 -0
  77. package/bin/nodes/FixedVectorNodes.js.map +1 -0
  78. package/bin/nodes/VectorNodes.d.ts +62 -0
  79. package/bin/nodes/VectorNodes.d.ts.map +1 -0
  80. package/bin/nodes/VectorNodes.js +355 -0
  81. package/bin/nodes/VectorNodes.js.map +1 -0
  82. package/bin/nodes/index.d.ts +20 -0
  83. package/bin/nodes/index.d.ts.map +1 -0
  84. package/bin/nodes/index.js +27 -0
  85. package/bin/nodes/index.js.map +1 -0
  86. package/package.json +45 -26
  87. package/index.cjs +0 -2
  88. package/index.cjs.map +0 -1
  89. package/index.d.ts +0 -1968
  90. package/index.mjs +0 -2
  91. package/index.mjs.map +0 -1
  92. package/index.umd.js +0 -2
  93. package/index.umd.js.map +0 -1
@@ -0,0 +1,288 @@
1
+ import { Vector2 } from './Vector2';
2
+ /**
3
+ * 3x3变换矩阵类
4
+ * 3x3 Transform Matrix Class
5
+ *
6
+ * 用于2D变换(平移、旋转、缩放)的3x3矩阵
7
+ * 使用左手坐标系(顺时针正旋转)
8
+ *
9
+ * 矩阵布局(顺时针旋转):
10
+ * [m00, m01, m02] [scaleX * cos, scaleY * sin, translateX]
11
+ * [m10, m11, m12] = [-scaleX * sin, scaleY * cos, translateY]
12
+ * [m20, m21, m22] [0, 0, 1]
13
+ */
14
+ export declare class Matrix3 {
15
+ /** 矩阵元素,按行优先存储 */
16
+ elements: Float32Array;
17
+ /**
18
+ * 创建3x3矩阵
19
+ * @param elements 矩阵元素数组(可选),默认为单位矩阵
20
+ */
21
+ constructor(elements?: ArrayLike<number>);
22
+ /** 单位矩阵 */
23
+ static readonly IDENTITY: Matrix3;
24
+ /** 零矩阵 */
25
+ static readonly ZERO: Matrix3;
26
+ /** 获取矩阵元素 */
27
+ get(row: number, col: number): number;
28
+ /** 设置矩阵元素 */
29
+ set(row: number, col: number, value: number): this;
30
+ get m00(): number;
31
+ set m00(value: number);
32
+ get m01(): number;
33
+ set m01(value: number);
34
+ get m02(): number;
35
+ set m02(value: number);
36
+ get m10(): number;
37
+ set m10(value: number);
38
+ get m11(): number;
39
+ set m11(value: number);
40
+ get m12(): number;
41
+ set m12(value: number);
42
+ get m20(): number;
43
+ set m20(value: number);
44
+ get m21(): number;
45
+ set m21(value: number);
46
+ get m22(): number;
47
+ set m22(value: number);
48
+ /**
49
+ * 设置矩阵为单位矩阵
50
+ * @returns 当前矩阵实例(链式调用)
51
+ */
52
+ identity(): this;
53
+ /**
54
+ * 设置矩阵为零矩阵
55
+ * @returns 当前矩阵实例(链式调用)
56
+ */
57
+ zero(): this;
58
+ /**
59
+ * 复制另一个矩阵的值
60
+ * @param other 源矩阵
61
+ * @returns 当前矩阵实例(链式调用)
62
+ */
63
+ copy(other: Matrix3): this;
64
+ /**
65
+ * 克隆当前矩阵
66
+ * @returns 新的矩阵实例
67
+ */
68
+ clone(): Matrix3;
69
+ /**
70
+ * 从数组设置矩阵元素
71
+ * @param elements 矩阵元素数组
72
+ * @returns 当前矩阵实例(链式调用)
73
+ */
74
+ fromArray(elements: ArrayLike<number>): this;
75
+ /**
76
+ * 矩阵加法
77
+ * @param other 另一个矩阵
78
+ * @returns 当前矩阵实例(链式调用)
79
+ */
80
+ add(other: Matrix3): this;
81
+ /**
82
+ * 矩阵减法
83
+ * @param other 另一个矩阵
84
+ * @returns 当前矩阵实例(链式调用)
85
+ */
86
+ subtract(other: Matrix3): this;
87
+ /**
88
+ * 矩阵标量乘法
89
+ * @param scalar 标量
90
+ * @returns 当前矩阵实例(链式调用)
91
+ */
92
+ multiplyScalar(scalar: number): this;
93
+ /**
94
+ * 矩阵乘法
95
+ * @param other 另一个矩阵
96
+ * @returns 当前矩阵实例(链式调用)
97
+ */
98
+ multiply(other: Matrix3): this;
99
+ /**
100
+ * 左乘另一个矩阵(other * this)
101
+ * @param other 左乘矩阵
102
+ * @returns 当前矩阵实例(链式调用)
103
+ */
104
+ premultiply(other: Matrix3): this;
105
+ /**
106
+ * 设置为平移矩阵
107
+ * @param x X方向平移
108
+ * @param y Y方向平移
109
+ * @returns 当前矩阵实例(链式调用)
110
+ */
111
+ makeTranslation(x: number, y: number): this;
112
+ /**
113
+ * 设置为旋转矩阵(顺时针为正)
114
+ * Set as rotation matrix (clockwise positive)
115
+ *
116
+ * 使用左手坐标系约定:正角度 = 顺时针旋转
117
+ * Uses left-hand coordinate system: positive angle = clockwise
118
+ *
119
+ * @param angle 旋转角度(弧度)
120
+ * @returns 当前矩阵实例(链式调用)
121
+ */
122
+ makeRotation(angle: number): this;
123
+ /**
124
+ * 设置为缩放矩阵
125
+ * @param scaleX X方向缩放
126
+ * @param scaleY Y方向缩放
127
+ * @returns 当前矩阵实例(链式调用)
128
+ */
129
+ makeScale(scaleX: number, scaleY: number): this;
130
+ /**
131
+ * 复合平移
132
+ * @param x X方向平移
133
+ * @param y Y方向平移
134
+ * @returns 当前矩阵实例(链式调用)
135
+ */
136
+ translate(x: number, y: number): this;
137
+ /**
138
+ * 复合旋转(顺时针为正)
139
+ * Composite rotation (clockwise positive)
140
+ *
141
+ * 使用左手坐标系约定:正角度 = 顺时针旋转
142
+ * Uses left-hand coordinate system: positive angle = clockwise
143
+ *
144
+ * @param angle 旋转角度(弧度)
145
+ * @returns 当前矩阵实例(链式调用)
146
+ */
147
+ rotate(angle: number): this;
148
+ /**
149
+ * 复合缩放
150
+ * @param scaleX X方向缩放
151
+ * @param scaleY Y方向缩放
152
+ * @returns 当前矩阵实例(链式调用)
153
+ */
154
+ scale(scaleX: number, scaleY: number): this;
155
+ /**
156
+ * 矩阵转置
157
+ * @returns 当前矩阵实例(链式调用)
158
+ */
159
+ transpose(): this;
160
+ /**
161
+ * 计算矩阵行列式
162
+ * @returns 行列式值
163
+ */
164
+ determinant(): number;
165
+ /**
166
+ * 矩阵求逆
167
+ * @returns 当前矩阵实例(链式调用),如果矩阵不可逆则保持不变
168
+ */
169
+ invert(): this;
170
+ /**
171
+ * 变换向量(应用完整的3x3变换)
172
+ * @param vector 向量
173
+ * @returns 新的变换后的向量
174
+ */
175
+ transformVector(vector: Vector2): Vector2;
176
+ /**
177
+ * 变换向量(仅应用旋转和缩放,忽略平移)
178
+ * @param vector 向量
179
+ * @returns 新的变换后的向量
180
+ */
181
+ transformDirection(vector: Vector2): Vector2;
182
+ /**
183
+ * 批量变换向量数组
184
+ * @param vectors 向量数组
185
+ * @returns 变换后的向量数组
186
+ */
187
+ transformVectors(vectors: Vector2[]): Vector2[];
188
+ /**
189
+ * 获取平移分量
190
+ * @returns 平移向量
191
+ */
192
+ getTranslation(): Vector2;
193
+ /**
194
+ * 获取旋转角度(顺时针为正)
195
+ * Get rotation angle (clockwise positive)
196
+ * @returns 旋转角度(弧度)
197
+ */
198
+ getRotation(): number;
199
+ /**
200
+ * 获取缩放分量
201
+ * @returns 缩放向量
202
+ */
203
+ getScale(): Vector2;
204
+ /**
205
+ * 分解变换矩阵为平移、旋转、缩放分量
206
+ * @returns {translation, rotation, scale}
207
+ */
208
+ decompose(): {
209
+ translation: Vector2;
210
+ rotation: number;
211
+ scale: Vector2;
212
+ };
213
+ /**
214
+ * 检查两个矩阵是否相等
215
+ * @param other 另一个矩阵
216
+ * @param epsilon 容差,默认为Number.EPSILON
217
+ * @returns 是否相等
218
+ */
219
+ equals(other: Matrix3, epsilon?: number): boolean;
220
+ /**
221
+ * 检查两个矩阵是否完全相等
222
+ * @param other 另一个矩阵
223
+ * @returns 是否完全相等
224
+ */
225
+ exactEquals(other: Matrix3): boolean;
226
+ /**
227
+ * 检查是否为单位矩阵
228
+ * @param epsilon 容差,默认为Number.EPSILON
229
+ * @returns 是否为单位矩阵
230
+ */
231
+ isIdentity(epsilon?: number): boolean;
232
+ /**
233
+ * 矩阵乘法(静态方法)
234
+ * @param a 矩阵a
235
+ * @param b 矩阵b
236
+ * @returns 新的结果矩阵
237
+ */
238
+ static multiply(a: Matrix3, b: Matrix3): Matrix3;
239
+ /**
240
+ * 创建平移矩阵(静态方法)
241
+ * @param x X方向平移
242
+ * @param y Y方向平移
243
+ * @returns 新的平移矩阵
244
+ */
245
+ static translation(x: number, y: number): Matrix3;
246
+ /**
247
+ * 创建旋转矩阵(静态方法)
248
+ * @param angle 旋转角度(弧度)
249
+ * @returns 新的旋转矩阵
250
+ */
251
+ static rotation(angle: number): Matrix3;
252
+ /**
253
+ * 创建缩放矩阵(静态方法)
254
+ * @param scaleX X方向缩放
255
+ * @param scaleY Y方向缩放
256
+ * @returns 新的缩放矩阵
257
+ */
258
+ static scale(scaleX: number, scaleY: number): Matrix3;
259
+ /**
260
+ * 创建TRS(平移-旋转-缩放)变换矩阵(顺时针为正)
261
+ * Create TRS (Translate-Rotate-Scale) matrix (clockwise positive)
262
+ *
263
+ * 使用左手坐标系约定:正角度 = 顺时针旋转
264
+ * Uses left-hand coordinate system: positive angle = clockwise
265
+ *
266
+ * @param translation 平移向量
267
+ * @param rotation 旋转角度(弧度)
268
+ * @param scale 缩放向量
269
+ * @returns 新的TRS矩阵
270
+ */
271
+ static TRS(translation: Vector2, rotation: number, scale: Vector2): Matrix3;
272
+ /**
273
+ * 转换为字符串
274
+ * @returns 字符串表示
275
+ */
276
+ toString(): string;
277
+ /**
278
+ * 转换为数组
279
+ * @returns 矩阵元素数组
280
+ */
281
+ toArray(): number[];
282
+ /**
283
+ * 转换为CSS transform字符串
284
+ * @returns CSS transform字符串
285
+ */
286
+ toCSSTransform(): string;
287
+ }
288
+ //# sourceMappingURL=Matrix3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Matrix3.d.ts","sourceRoot":"","sources":["../src/Matrix3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO;IAChB,kBAAkB;IACX,QAAQ,EAAE,YAAY,CAAC;IAE9B;;;KAGC;gBACW,QAAQ,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC;IAWxC,WAAW;IACX,MAAM,CAAC,QAAQ,CAAC,QAAQ,UAIrB;IAEH,UAAU;IACV,MAAM,CAAC,QAAQ,CAAC,IAAI,UAIjB;IAIH,aAAa;IACb,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIr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