@next2d/geom 1.18.11 → 2.0.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 (98) hide show
  1. package/package.json +8 -24
  2. package/src/ColorTransform/service/ColorTransformConcatService.d.ts +12 -0
  3. package/src/ColorTransform/service/ColorTransformConcatService.js +25 -0
  4. package/{dist → src}/ColorTransform.d.ts +57 -69
  5. package/src/ColorTransform.js +240 -0
  6. package/src/GeomUtil.d.ts +63 -0
  7. package/src/GeomUtil.js +102 -0
  8. package/src/Matrix/service/MatirxConcatService.d.ts +12 -0
  9. package/src/Matrix/service/MatirxConcatService.js +34 -0
  10. package/src/Matrix/service/MatrixCloneService.d.ts +11 -0
  11. package/src/Matrix/service/MatrixCloneService.js +13 -0
  12. package/src/Matrix/service/MatrixCopyFromService.d.ts +12 -0
  13. package/src/Matrix/service/MatrixCopyFromService.js +18 -0
  14. package/src/Matrix/service/MatrixCreateBoxService.d.ts +15 -0
  15. package/src/Matrix/service/MatrixCreateBoxService.js +19 -0
  16. package/src/Matrix/service/MatrixCreateGradientBoxService.d.ts +16 -0
  17. package/src/Matrix/service/MatrixCreateGradientBoxService.js +33 -0
  18. package/src/Matrix/service/MatrixDeltaTransformPointService.d.ts +13 -0
  19. package/src/Matrix/service/MatrixDeltaTransformPointService.js +14 -0
  20. package/src/Matrix/service/MatrixIdentityService.d.ts +11 -0
  21. package/src/Matrix/service/MatrixIdentityService.js +17 -0
  22. package/src/Matrix/service/MatrixInvertService.d.ts +11 -0
  23. package/src/Matrix/service/MatrixInvertService.js +37 -0
  24. package/src/Matrix/service/MatrixRotateService.d.ts +11 -0
  25. package/src/Matrix/service/MatrixRotateService.js +24 -0
  26. package/src/Matrix/service/MatrixScaleService.d.ts +13 -0
  27. package/src/Matrix/service/MatrixScaleService.js +20 -0
  28. package/src/Matrix/service/MatrixSetToService.d.ts +17 -0
  29. package/src/Matrix/service/MatrixSetToService.js +24 -0
  30. package/src/Matrix/service/MatrixTransformPointService.d.ts +13 -0
  31. package/src/Matrix/service/MatrixTransformPointService.js +17 -0
  32. package/src/Matrix/service/MatrixTranslateService.d.ts +13 -0
  33. package/src/Matrix/service/MatrixTranslateService.js +15 -0
  34. package/{dist → src}/Matrix.d.ts +45 -69
  35. package/{dist → src}/Matrix.js +92 -204
  36. package/src/Point/service/PointAddService.d.ts +12 -0
  37. package/src/Point/service/PointAddService.js +14 -0
  38. package/src/Point/service/PointCloneService.d.ts +11 -0
  39. package/src/Point/service/PointCloneService.js +13 -0
  40. package/src/Point/service/PointCopyFromService.d.ts +12 -0
  41. package/src/Point/service/PointCopyFromService.js +14 -0
  42. package/src/Point/service/PointDistanceService.d.ts +12 -0
  43. package/src/Point/service/PointDistanceService.js +14 -0
  44. package/src/Point/service/PointEqualsService.d.ts +12 -0
  45. package/src/Point/service/PointEqualsService.js +13 -0
  46. package/src/Point/service/PointInterpolateService.d.ts +13 -0
  47. package/src/Point/service/PointInterpolateService.js +15 -0
  48. package/src/Point/service/PointNormalizeService.d.ts +12 -0
  49. package/src/Point/service/PointNormalizeService.js +15 -0
  50. package/src/Point/service/PointOffsetService.d.ts +13 -0
  51. package/src/Point/service/PointOffsetService.js +15 -0
  52. package/src/Point/service/PointPolarService.d.ts +12 -0
  53. package/src/Point/service/PointPolarService.js +14 -0
  54. package/src/Point/service/PointSetToService.d.ts +13 -0
  55. package/src/Point/service/PointSetToService.js +15 -0
  56. package/src/Point/service/PointSubtractService.d.ts +12 -0
  57. package/src/Point/service/PointSubtractService.js +14 -0
  58. package/{dist → src}/Point.d.ts +34 -82
  59. package/{dist → src}/Point.js +67 -128
  60. package/src/Rectangle/service/RectangleCloneService.d.ts +11 -0
  61. package/src/Rectangle/service/RectangleCloneService.js +13 -0
  62. package/src/Rectangle/service/RectangleContainsPointService.d.ts +13 -0
  63. package/src/Rectangle/service/RectangleContainsPointService.js +16 -0
  64. package/src/Rectangle/service/RectangleContainsRectService.d.ts +12 -0
  65. package/src/Rectangle/service/RectangleContainsRectService.js +16 -0
  66. package/src/Rectangle/service/RectangleContainsService.d.ts +13 -0
  67. package/src/Rectangle/service/RectangleContainsService.js +17 -0
  68. package/src/Rectangle/service/RectangleCopyFromService.d.ts +12 -0
  69. package/src/Rectangle/service/RectangleCopyFromService.js +16 -0
  70. package/src/Rectangle/service/RectangleEqualsService.d.ts +12 -0
  71. package/src/Rectangle/service/RectangleEqualsService.js +16 -0
  72. package/src/Rectangle/service/RectangleInflatePointService.d.ts +13 -0
  73. package/src/Rectangle/service/RectangleInflatePointService.js +16 -0
  74. package/src/Rectangle/service/RectangleInflateService.d.ts +13 -0
  75. package/src/Rectangle/service/RectangleInflateService.js +17 -0
  76. package/src/Rectangle/service/RectangleIntersectionService.d.ts +12 -0
  77. package/src/Rectangle/service/RectangleIntersectionService.js +22 -0
  78. package/src/Rectangle/service/RectangleIntersectsService.d.ts +12 -0
  79. package/src/Rectangle/service/RectangleIntersectsService.js +17 -0
  80. package/src/Rectangle/service/RectangleIsEmptyService.d.ts +11 -0
  81. package/src/Rectangle/service/RectangleIsEmptyService.js +12 -0
  82. package/src/Rectangle/service/RectangleOffsetPointService.d.ts +13 -0
  83. package/src/Rectangle/service/RectangleOffsetPointService.js +14 -0
  84. package/src/Rectangle/service/RectangleOffsetService.d.ts +13 -0
  85. package/src/Rectangle/service/RectangleOffsetService.js +15 -0
  86. package/src/Rectangle/service/RectangleSetEmptyService.d.ts +11 -0
  87. package/src/Rectangle/service/RectangleSetEmptyService.js +12 -0
  88. package/src/Rectangle/service/RectangleSetToService.d.ts +15 -0
  89. package/src/Rectangle/service/RectangleSetToService.js +19 -0
  90. package/src/Rectangle/service/RectangleUnionService.d.ts +12 -0
  91. package/src/Rectangle/service/RectangleUnionService.js +20 -0
  92. package/{dist → src}/Rectangle.d.ts +50 -102
  93. package/{dist → src}/Rectangle.js +110 -205
  94. package/{dist → src}/index.d.ts +0 -1
  95. package/{dist → src}/index.js +0 -1
  96. package/dist/ColorTransform.js +0 -278
  97. package/dist/Transform.d.ts +0 -209
  98. package/dist/Transform.js +0 -478
@@ -1,26 +1,28 @@
1
- import { Point } from "./Point";
2
- import { $getMatrix } from "@next2d/util";
3
- import { $getFloat32Array6, $clamp, $Math, $SHORT_INT_MIN, $SHORT_INT_MAX } from "@next2d/share";
1
+ import { execute as matrixCloneService } from "../src/Matrix/service/MatrixCloneService";
2
+ import { execute as matirxConcatService } from "../src/Matrix/service/MatirxConcatService";
3
+ import { execute as matrixCopyFromService } from "../src/Matrix/service/MatrixCopyFromService";
4
+ import { execute as matrixCreateBoxService } from "../src/Matrix/service/MatrixCreateBoxService";
5
+ import { execute as matrixCreateGradientBoxService } from "../src/Matrix/service/MatrixCreateGradientBoxService";
6
+ import { execute as matrixDeltaTransformPointService } from "../src/Matrix/service/MatrixDeltaTransformPointService";
7
+ import { execute as matrixIdentityService } from "../src/Matrix/service/MatrixIdentityService";
8
+ import { execute as matrixInvertService } from "../src/Matrix/service/MatrixInvertService";
9
+ import { execute as matrixRotateService } from "../src/Matrix/service/MatrixRotateService";
10
+ import { execute as matrixScaleService } from "../src/Matrix/service/MatrixScaleService";
11
+ import { execute as matrixSetToService } from "../src/Matrix/service/MatrixSetToService";
12
+ import { execute as matrixTransformPointService } from "../src/Matrix/service/MatrixTransformPointService";
13
+ import { execute as matrixTranslateService } from "../src/Matrix/service/MatrixTranslateService";
14
+ import { $getFloat32Array6, $poolFloat32Array6 } from "./GeomUtil";
4
15
  /**
5
- * Matrix クラスは、2 つの座標空間の間におけるポイントのマッピング方法を決定する変換マトリックスを表します。
6
- * Matrix オブジェクトのプロパティを設定し、Matrix オブジェクトを Transform オブジェクトの matrix プロパティに適用し、
7
- * 次に Transform オブジェクトを表示オブジェクトの transform プロパティとして適用することで、表示オブジェクトに対する各種グラフィック変換を実行できます。
8
- * これらの変換機能には、平行移動(x と y の位置変更)、回転、拡大 / 縮小、傾斜などが含まれます。
16
+ * @description Matrix クラスは、2 つの座標空間の間におけるポイントのマッピング方法を決定する変換マトリックスを表します。
17
+ * Matrix オブジェクトのプロパティを設定し、Matrix オブジェクトを Transform オブジェクトの matrix プロパティに適用し、
18
+ * 次に Transform オブジェクトを表示オブジェクトの transform プロパティとして適用することで、表示オブジェクトに対する各種グラフィック変換を実行できます。
19
+ * これらの変換機能には、平行移動(x と y の位置変更)、回転、拡大 / 縮小、傾斜などが含まれます。
9
20
  *
10
- * The Matrix class represents a transformation matrix that determines how to map points from one coordinate space to another.
11
- * You can perform various graphical transformations on a display object by setting the properties of a Matrix object,
12
- * applying that Matrix object to the matrix property of a Transform object,
13
- * and then applying that Transform object as the transform property of the display object.
14
- * These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.
15
- *
16
- * @example <caption>Example usage of Matrix.</caption>
17
- * // new Matrix
18
- * const {Matrix} = next2d.geom;
19
- * const matrix = new Matrix();
20
- * // set new Matrix
21
- * const {MovieClip} = next2d.display;
22
- * const movieClip = new MovieClip();
23
- * movieClip.transform.matrix = matrix;
21
+ * The Matrix class represents a transformation matrix that determines how to map points from one coordinate space to another.
22
+ * You can perform various graphical transformations on a display object by setting the properties of a Matrix object,
23
+ * applying that Matrix object to the matrix property of a Transform object,
24
+ * and then applying that Transform object as the transform property of the display object.
25
+ * These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.
24
26
  *
25
27
  * @class
26
28
  * @memberOf next2d.geom
@@ -38,65 +40,17 @@ export class Matrix {
38
40
  * @public
39
41
  */
40
42
  constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
43
+ Object.defineProperty(this, "_$matrix", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: void 0
48
+ });
41
49
  /**
42
50
  * @type {Float32Array}
43
51
  * @private
44
52
  */
45
- this._$matrix = $getFloat32Array6(1, 0, 0, 1, 0, 0);
46
- // setup
47
- this.a = a;
48
- this.b = b;
49
- this.c = c;
50
- this.d = d;
51
- this.tx = tx;
52
- this.ty = ty;
53
- }
54
- /**
55
- * 指定されたクラスのストリングを返します。
56
- * Returns the string representation of the specified class.
57
- *
58
- * @return {string}
59
- * @default [class Matrix]
60
- * @method
61
- * @static
62
- */
63
- static toString() {
64
- return "[class Matrix]";
65
- }
66
- /**
67
- * @description 指定されたクラスの空間名を返します。
68
- * Returns the space name of the specified class.
69
- *
70
- * @member {string}
71
- * @default next2d.geom.Matrix
72
- * @const
73
- * @static
74
- */
75
- static get namespace() {
76
- return "next2d.geom.Matrix";
77
- }
78
- /**
79
- * @description 指定されたオブジェクトのストリングを返します。
80
- * Returns the string representation of the specified object.
81
- *
82
- * @return {string}
83
- * @method
84
- * @public
85
- */
86
- toString() {
87
- return `(a=${this.a}, b=${this.b}, c=${this.c}, d=${this.d}, tx=${this.tx}, ty=${this.ty})`;
88
- }
89
- /**
90
- * @description 指定されたオブジェクトの空間名を返します。
91
- * Returns the space name of the specified object.
92
- *
93
- * @member {string}
94
- * @default next2d.geom.Matrix
95
- * @const
96
- * @public
97
- */
98
- get namespace() {
99
- return "next2d.geom.Matrix";
53
+ this._$matrix = $getFloat32Array6(a, b, c, d, tx, ty);
100
54
  }
101
55
  /**
102
56
  * @description イメージを拡大 / 縮小または回転するときに x 軸方向のピクセルの配置に影響を与える値です。
@@ -111,7 +65,7 @@ export class Matrix {
111
65
  return this._$matrix[0];
112
66
  }
113
67
  set a(a) {
114
- this._$matrix[0] = $clamp(+a, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
68
+ this._$matrix[0] = a;
115
69
  }
116
70
  /**
117
71
  * @description イメージを回転または傾斜させるときに y 軸方向のピクセルの配置に影響を与える値です。
@@ -126,7 +80,7 @@ export class Matrix {
126
80
  return this._$matrix[1];
127
81
  }
128
82
  set b(b) {
129
- this._$matrix[1] = $clamp(+b, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
83
+ this._$matrix[1] = b;
130
84
  }
131
85
  /**
132
86
  * @description イメージを回転または傾斜させるときに x 軸方向のピクセルの配置に影響を与える値です。
@@ -141,7 +95,7 @@ export class Matrix {
141
95
  return this._$matrix[2];
142
96
  }
143
97
  set c(c) {
144
- this._$matrix[2] = $clamp(+c, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
98
+ this._$matrix[2] = c;
145
99
  }
146
100
  /**
147
101
  * @description イメージを拡大 / 縮小または回転するときに y 軸方向のピクセルの配置に影響を与える値です。
@@ -156,7 +110,7 @@ export class Matrix {
156
110
  return this._$matrix[3];
157
111
  }
158
112
  set d(d) {
159
- this._$matrix[3] = $clamp(+d, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
113
+ this._$matrix[3] = d;
160
114
  }
161
115
  /**
162
116
  * @description x 軸方向に各ポイントを平行移動する距離です。
@@ -170,7 +124,7 @@ export class Matrix {
170
124
  return this._$matrix[4];
171
125
  }
172
126
  set tx(tx) {
173
- this._$matrix[4] = $clamp(+tx, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
127
+ this._$matrix[4] = tx;
174
128
  }
175
129
  /**
176
130
  * @description y 軸方向に各ポイントを平行移動する距離です。
@@ -184,15 +138,18 @@ export class Matrix {
184
138
  return this._$matrix[5];
185
139
  }
186
140
  set ty(ty) {
187
- this._$matrix[5] = $clamp(+ty, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
141
+ this._$matrix[5] = ty;
188
142
  }
189
143
  /**
190
- * @return {Matrix}
191
- * @method
192
- * @private
144
+ * @description Matrixの内部Float32Arrayデータを返却
145
+ * Returns the internal Float32Array data of Matrix
146
+ *
147
+ * @member {Float32Array}
148
+ * @readonly
149
+ * @public
193
150
  */
194
- _$clone() {
195
- return this.clone();
151
+ get rawData() {
152
+ return this._$matrix;
196
153
  }
197
154
  /**
198
155
  * @description 新しい Matrix オブジェクトとして、このマトリックスのクローンを返します。
@@ -205,7 +162,7 @@ export class Matrix {
205
162
  * @public
206
163
  */
207
164
  clone() {
208
- return $getMatrix(this._$matrix[0], this._$matrix[1], this._$matrix[2], this._$matrix[3], this._$matrix[4], this._$matrix[5]);
165
+ return matrixCloneService(this);
209
166
  }
210
167
  /**
211
168
  * @description マトリックスを現在のマトリックスと連結して、
@@ -213,50 +170,25 @@ export class Matrix {
213
170
  * Concatenates a matrix with the current matrix,
214
171
  * effectively combining the geometric effects of the two.
215
172
  *
216
- * @param {Matrix} m
173
+ * @param {Matrix} matrix
217
174
  * @return {void}
218
175
  * @method
219
176
  * @public
220
177
  */
221
- concat(m) {
222
- const matrix = this._$matrix;
223
- const target = m._$matrix;
224
- let a = matrix[0] * target[0];
225
- let b = 0.0;
226
- let c = 0.0;
227
- let d = matrix[3] * target[3];
228
- let tx = matrix[4] * target[0] + target[4];
229
- let ty = matrix[5] * target[3] + target[5];
230
- if (matrix[1] || matrix[2] || target[1] || target[2]) {
231
- a += matrix[1] * target[2];
232
- d += matrix[2] * target[1];
233
- b += matrix[0] * target[1] + matrix[1] * target[3];
234
- c += matrix[2] * target[0] + matrix[3] * target[2];
235
- tx += matrix[5] * target[2];
236
- ty += matrix[4] * target[1];
237
- }
238
- this.a = a;
239
- this.b = b;
240
- this.c = c;
241
- this.d = d;
242
- this.tx = tx;
243
- this.ty = ty;
178
+ concat(matrix) {
179
+ matirxConcatService(this, matrix);
244
180
  }
245
181
  /**
246
182
  * @description すべてのマトリックスデータを、ソース Matrix オブジェクトから、
247
183
  * 呼び出し元の Matrix オブジェクトにコピーします。
248
184
  *
249
- * @param {Matrix} source_matrix
250
- * @method
185
+ * @param {Matrix} matrix
251
186
  * @return {void}
187
+ * @method
188
+ * @public
252
189
  */
253
- copyFrom(source_matrix) {
254
- this.a = source_matrix.a;
255
- this.b = source_matrix.b;
256
- this.c = source_matrix.c;
257
- this.d = source_matrix.d;
258
- this.tx = source_matrix.tx;
259
- this.ty = source_matrix.ty;
190
+ copyFrom(matrix) {
191
+ matrixCopyFromService(this, matrix);
260
192
  }
261
193
  /**
262
194
  * @description 拡大 / 縮小、回転、平行移動に関するパラメーターなどがあります。
@@ -272,10 +204,7 @@ export class Matrix {
272
204
  * @public
273
205
  */
274
206
  createBox(scale_x, scale_y, rotation = 0, tx = 0, ty = 0) {
275
- this.identity();
276
- this.rotate(rotation);
277
- this.scale(scale_x, scale_y);
278
- this.translate(tx, ty);
207
+ matrixCreateBoxService(this, scale_x, scale_y, rotation, tx, ty);
279
208
  }
280
209
  /**
281
210
  * @description Graphics クラスの beginGradientFill() メソッドで使用する特定のスタイルを作成します。
@@ -292,22 +221,7 @@ export class Matrix {
292
221
  * @public
293
222
  */
294
223
  createGradientBox(width, height, rotation = 0, tx = 0, ty = 0) {
295
- this.a = width / 1638.4;
296
- this.d = height / 1638.4;
297
- if (rotation) {
298
- const cos = $Math.cos(rotation);
299
- const sin = $Math.sin(rotation);
300
- this.b = sin * this.d;
301
- this.c = -sin * this.a;
302
- this.a *= cos;
303
- this.d *= cos;
304
- }
305
- else {
306
- this.b = 0;
307
- this.c = 0;
308
- }
309
- this.tx = tx + width / 2;
310
- this.ty = ty + height / 2;
224
+ matrixCreateGradientBoxService(this, width, height, rotation, tx, ty);
311
225
  }
312
226
  /**
313
227
  * @description 変換前の座標空間内のポイントが指定されると、そのポイントの変換後の座標を返します。
@@ -320,7 +234,7 @@ export class Matrix {
320
234
  * @public
321
235
  */
322
236
  deltaTransformPoint(point) {
323
- return new Point(point.x * this._$matrix[0] + point.y * this._$matrix[2], point.x * this._$matrix[1] + point.y * this._$matrix[3]);
237
+ return matrixDeltaTransformPointService(this, point);
324
238
  }
325
239
  /**
326
240
  * @description 各行列プロパティを null 変換になる値に設定します。
@@ -331,12 +245,7 @@ export class Matrix {
331
245
  * @public
332
246
  */
333
247
  identity() {
334
- this._$matrix[0] = 1;
335
- this._$matrix[1] = 0;
336
- this._$matrix[2] = 0;
337
- this._$matrix[3] = 1;
338
- this._$matrix[4] = 0;
339
- this._$matrix[5] = 0;
248
+ matrixIdentityService(this);
340
249
  }
341
250
  /**
342
251
  * @description 元のマトリックスの逆の変換を実行します。
@@ -347,32 +256,7 @@ export class Matrix {
347
256
  * @public
348
257
  */
349
258
  invert() {
350
- const a = this._$matrix[0];
351
- const b = this._$matrix[1];
352
- const c = this._$matrix[2];
353
- const d = this._$matrix[3];
354
- const tx = this._$matrix[4];
355
- const ty = this._$matrix[5];
356
- if (b === 0 && c === 0) {
357
- this.a = 1 / a;
358
- this.b = 0;
359
- this.c = 0;
360
- this.d = 1 / d;
361
- this.tx = -this.a * tx;
362
- this.ty = -this.d * ty;
363
- }
364
- else {
365
- const det = a * d - b * c;
366
- if (det) {
367
- const rdet = 1 / det;
368
- this.a = d * rdet;
369
- this.b = -b * rdet;
370
- this.c = -c * rdet;
371
- this.d = a * rdet;
372
- this.tx = -(this.a * tx + this.c * ty);
373
- this.ty = -(this.b * tx + this.d * ty);
374
- }
375
- }
259
+ matrixInvertService(this);
376
260
  }
377
261
  /**
378
262
  * @description Matrix オブジェクトに回転変換を適用します。
@@ -384,36 +268,20 @@ export class Matrix {
384
268
  * @public
385
269
  */
386
270
  rotate(rotation) {
387
- const a = this._$matrix[0];
388
- const b = this._$matrix[1];
389
- const c = this._$matrix[2];
390
- const d = this._$matrix[3];
391
- const tx = this._$matrix[4];
392
- const ty = this._$matrix[5];
393
- this.a = a * $Math.cos(rotation) - b * $Math.sin(rotation);
394
- this.b = a * $Math.sin(rotation) + b * $Math.cos(rotation);
395
- this.c = c * $Math.cos(rotation) - d * $Math.sin(rotation);
396
- this.d = c * $Math.sin(rotation) + d * $Math.cos(rotation);
397
- this.tx = tx * $Math.cos(rotation) - ty * $Math.sin(rotation);
398
- this.ty = tx * $Math.sin(rotation) + ty * $Math.cos(rotation);
271
+ matrixRotateService(this, rotation);
399
272
  }
400
273
  /**
401
274
  * @description 行列に拡大 / 縮小の変換を適用します。
402
275
  * Applies a scaling transformation to the matrix.
403
276
  *
404
- * @param {number} sx
405
- * @param {number} sy
277
+ * @param {number} scale_x
278
+ * @param {number} scale_y
406
279
  * @return {void}
407
280
  * @method
408
281
  * @public
409
282
  */
410
- scale(sx, sy) {
411
- this.a *= sx;
412
- this.c *= sx;
413
- this.tx *= sx;
414
- this.b *= sy;
415
- this.d *= sy;
416
- this.ty *= sy;
283
+ scale(scale_x, scale_y) {
284
+ matrixScaleService(this, scale_x, scale_y);
417
285
  }
418
286
  /**
419
287
  * @description Matrix のメンバーを指定の値に設定します。
@@ -430,12 +298,7 @@ export class Matrix {
430
298
  * @public
431
299
  */
432
300
  setTo(a, b, c, d, tx, ty) {
433
- this.a = a;
434
- this.b = b;
435
- this.c = c;
436
- this.d = d;
437
- this.tx = tx;
438
- this.ty = ty;
301
+ matrixSetToService(this, a, b, c, d, tx, ty);
439
302
  }
440
303
  /**
441
304
  * @description Matrix オブジェクトで表現される図形変換を、指定されたポイントに適用した結果を返します。
@@ -448,7 +311,7 @@ export class Matrix {
448
311
  * @public
449
312
  */
450
313
  transformPoint(point) {
451
- return new Point(point.x * this._$matrix[0] + point.y * this._$matrix[2] + this._$matrix[4], point.x * this._$matrix[1] + point.y * this._$matrix[3] + this._$matrix[5]);
314
+ return matrixTransformPointService(this, point);
452
315
  }
453
316
  /**
454
317
  * @description 行列を x 軸と y 軸に沿って、
@@ -463,7 +326,32 @@ export class Matrix {
463
326
  * @public
464
327
  */
465
328
  translate(dx, dy) {
466
- this.tx += dx;
467
- this.ty += dy;
329
+ matrixTranslateService(this, dx, dy);
330
+ }
331
+ /**
332
+ * @description 指定された配列の値を乗算します
333
+ * Multiplies the value of the specified array.
334
+ *
335
+ * @param {Float32Array} a
336
+ * @param {Float32Array} b
337
+ * @return {Float32Array}
338
+ * @method
339
+ * @private
340
+ */
341
+ static multiply(a, b) {
342
+ const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
343
+ const b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
344
+ return $getFloat32Array6(a0 * b0 + a2 * b1, a1 * b0 + a3 * b1, a0 * b2 + a2 * b3, a1 * b2 + a3 * b3, a0 * b4 + a2 * b5 + a4, a1 * b4 + a3 * b5 + a5);
345
+ }
346
+ /**
347
+ * @description 利用したFloat32Arrayを再利用する為にプールします。
348
+ * Pool the Float32Array used for reuse.
349
+ *
350
+ * @param {Float32Array} buffer
351
+ * @method
352
+ * @private
353
+ */
354
+ static release(buffer) {
355
+ $poolFloat32Array6(buffer);
468
356
  }
469
357
  }
@@ -0,0 +1,12 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 2つの座標を加算します。
4
+ * Adds two points.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @return {Point}
9
+ * @method
10
+ * @public
11
+ */
12
+ export declare const execute: (point1: Point, point2: Point) => Point;
@@ -0,0 +1,14 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 2つの座標を加算します。
4
+ * Adds two points.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @return {Point}
9
+ * @method
10
+ * @public
11
+ */
12
+ export const execute = (point1, point2) => {
13
+ return new Point(point1.x + point2.x, point1.y + point2.y);
14
+ };
@@ -0,0 +1,11 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 座標を複製します。
4
+ * Duplicates the coordinates.
5
+ *
6
+ * @param {Point} src
7
+ * @return {Point}
8
+ * @method
9
+ * @public
10
+ */
11
+ export declare const execute: (src: Point) => Point;
@@ -0,0 +1,13 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 座標を複製します。
4
+ * Duplicates the coordinates.
5
+ *
6
+ * @param {Point} src
7
+ * @return {Point}
8
+ * @method
9
+ * @public
10
+ */
11
+ export const execute = (src) => {
12
+ return new Point(src.x, src.y);
13
+ };
@@ -0,0 +1,12 @@
1
+ import type { Point } from "../../Point";
2
+ /**
3
+ * @description 指定されたポイントの値をコピーします。
4
+ * Copies the value of the specified point.
5
+ *
6
+ * @param {Point} dst
7
+ * @param {Point} src
8
+ * @return {void}
9
+ * @method
10
+ * @public
11
+ */
12
+ export declare const execute: (dst: Point, src: Point) => void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description 指定されたポイントの値をコピーします。
3
+ * Copies the value of the specified point.
4
+ *
5
+ * @param {Point} dst
6
+ * @param {Point} src
7
+ * @return {void}
8
+ * @method
9
+ * @public
10
+ */
11
+ export const execute = (dst, src) => {
12
+ dst.x = src.x;
13
+ dst.y = src.y;
14
+ };
@@ -0,0 +1,12 @@
1
+ import type { Point } from "../../Point";
2
+ /**
3
+ * @description 2点間の距離を返します。
4
+ * Returns the distance between two points.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @return {number}
9
+ * @method
10
+ * @public
11
+ */
12
+ export declare const execute: (point1: Point, point2: Point) => number;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description 2点間の距離を返します。
3
+ * Returns the distance between two points.
4
+ *
5
+ * @param {Point} point1
6
+ * @param {Point} point2
7
+ * @return {number}
8
+ * @method
9
+ * @public
10
+ */
11
+ export const execute = (point1, point2) => {
12
+ return Math.sqrt(Math.pow(point1.x - point2.x, 2)
13
+ + Math.pow(point1.y - point2.y, 2));
14
+ };
@@ -0,0 +1,12 @@
1
+ import type { Point } from "../../Point";
2
+ /**
3
+ * @description 2点が等しいかどうかを返します。
4
+ * Returns whether two points are equal.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @return {boolean}
9
+ * @method
10
+ * @public
11
+ */
12
+ export declare const execute: (point1: Point, point2: Point) => boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @description 2点が等しいかどうかを返します。
3
+ * Returns whether two points are equal.
4
+ *
5
+ * @param {Point} point1
6
+ * @param {Point} point2
7
+ * @return {boolean}
8
+ * @method
9
+ * @public
10
+ */
11
+ export const execute = (point1, point2) => {
12
+ return point1.x === point2.x && point1.y === point2.y;
13
+ };
@@ -0,0 +1,13 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 2点間の補間を返します。
4
+ * Returns the interpolation between two points.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @param {number} f
9
+ * @return {Point}
10
+ * @method
11
+ * @public
12
+ */
13
+ export declare const execute: (point1: Point, point2: Point, f: number) => Point;
@@ -0,0 +1,15 @@
1
+ import { Point } from "../../Point";
2
+ /**
3
+ * @description 2点間の補間を返します。
4
+ * Returns the interpolation between two points.
5
+ *
6
+ * @param {Point} point1
7
+ * @param {Point} point2
8
+ * @param {number} f
9
+ * @return {Point}
10
+ * @method
11
+ * @public
12
+ */
13
+ export const execute = (point1, point2, f) => {
14
+ return new Point(point1.x + (point2.x - point1.x) * (1 - f), point1.y + (point2.y - point1.y) * (1 - f));
15
+ };
@@ -0,0 +1,12 @@
1
+ import type { Point } from "../../Point";
2
+ /**
3
+ * @description (0,0) と現在のポイント間の線のセグメントを設定された長さに拡大 / 縮小します。
4
+ * Expands / contracts the line segment between (0,0) and the current point to the specified length.
5
+ *
6
+ * @param {Point} point
7
+ * @param {number} thickness
8
+ * @return {void}
9
+ * @method
10
+ * @public
11
+ */
12
+ export declare const execute: (point: Point, thickness: number) => void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @description (0,0) と現在のポイント間の線のセグメントを設定された長さに拡大 / 縮小します。
3
+ * Expands / contracts the line segment between (0,0) and the current point to the specified length.
4
+ *
5
+ * @param {Point} point
6
+ * @param {number} thickness
7
+ * @return {void}
8
+ * @method
9
+ * @public
10
+ */
11
+ export const execute = (point, thickness) => {
12
+ const value = thickness / point.length;
13
+ point.x *= value;
14
+ point.y *= value;
15
+ };
@@ -0,0 +1,13 @@
1
+ import type { Point } from "../../Point";
2
+ /**
3
+ * @description 2点間の補間を返します。
4
+ * Returns the interpolation between two points.
5
+ *
6
+ * @param {Point} point
7
+ * @param {number} dx
8
+ * @param {number} dy
9
+ * @return {Point}
10
+ * @method
11
+ * @public
12
+ */
13
+ export declare const execute: (point: Point, dx: number, dy: number) => void;