@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.
- package/package.json +8 -24
- package/src/ColorTransform/service/ColorTransformConcatService.d.ts +12 -0
- package/src/ColorTransform/service/ColorTransformConcatService.js +25 -0
- package/{dist → src}/ColorTransform.d.ts +57 -69
- package/src/ColorTransform.js +240 -0
- package/src/GeomUtil.d.ts +63 -0
- package/src/GeomUtil.js +102 -0
- package/src/Matrix/service/MatirxConcatService.d.ts +12 -0
- package/src/Matrix/service/MatirxConcatService.js +34 -0
- package/src/Matrix/service/MatrixCloneService.d.ts +11 -0
- package/src/Matrix/service/MatrixCloneService.js +13 -0
- package/src/Matrix/service/MatrixCopyFromService.d.ts +12 -0
- package/src/Matrix/service/MatrixCopyFromService.js +18 -0
- package/src/Matrix/service/MatrixCreateBoxService.d.ts +15 -0
- package/src/Matrix/service/MatrixCreateBoxService.js +19 -0
- package/src/Matrix/service/MatrixCreateGradientBoxService.d.ts +16 -0
- package/src/Matrix/service/MatrixCreateGradientBoxService.js +33 -0
- package/src/Matrix/service/MatrixDeltaTransformPointService.d.ts +13 -0
- package/src/Matrix/service/MatrixDeltaTransformPointService.js +14 -0
- package/src/Matrix/service/MatrixIdentityService.d.ts +11 -0
- package/src/Matrix/service/MatrixIdentityService.js +17 -0
- package/src/Matrix/service/MatrixInvertService.d.ts +11 -0
- package/src/Matrix/service/MatrixInvertService.js +37 -0
- package/src/Matrix/service/MatrixRotateService.d.ts +11 -0
- package/src/Matrix/service/MatrixRotateService.js +24 -0
- package/src/Matrix/service/MatrixScaleService.d.ts +13 -0
- package/src/Matrix/service/MatrixScaleService.js +20 -0
- package/src/Matrix/service/MatrixSetToService.d.ts +17 -0
- package/src/Matrix/service/MatrixSetToService.js +24 -0
- package/src/Matrix/service/MatrixTransformPointService.d.ts +13 -0
- package/src/Matrix/service/MatrixTransformPointService.js +17 -0
- package/src/Matrix/service/MatrixTranslateService.d.ts +13 -0
- package/src/Matrix/service/MatrixTranslateService.js +15 -0
- package/{dist → src}/Matrix.d.ts +45 -69
- package/{dist → src}/Matrix.js +92 -204
- package/src/Point/service/PointAddService.d.ts +12 -0
- package/src/Point/service/PointAddService.js +14 -0
- package/src/Point/service/PointCloneService.d.ts +11 -0
- package/src/Point/service/PointCloneService.js +13 -0
- package/src/Point/service/PointCopyFromService.d.ts +12 -0
- package/src/Point/service/PointCopyFromService.js +14 -0
- package/src/Point/service/PointDistanceService.d.ts +12 -0
- package/src/Point/service/PointDistanceService.js +14 -0
- package/src/Point/service/PointEqualsService.d.ts +12 -0
- package/src/Point/service/PointEqualsService.js +13 -0
- package/src/Point/service/PointInterpolateService.d.ts +13 -0
- package/src/Point/service/PointInterpolateService.js +15 -0
- package/src/Point/service/PointNormalizeService.d.ts +12 -0
- package/src/Point/service/PointNormalizeService.js +15 -0
- package/src/Point/service/PointOffsetService.d.ts +13 -0
- package/src/Point/service/PointOffsetService.js +15 -0
- package/src/Point/service/PointPolarService.d.ts +12 -0
- package/src/Point/service/PointPolarService.js +14 -0
- package/src/Point/service/PointSetToService.d.ts +13 -0
- package/src/Point/service/PointSetToService.js +15 -0
- package/src/Point/service/PointSubtractService.d.ts +12 -0
- package/src/Point/service/PointSubtractService.js +14 -0
- package/{dist → src}/Point.d.ts +34 -82
- package/{dist → src}/Point.js +67 -128
- package/src/Rectangle/service/RectangleCloneService.d.ts +11 -0
- package/src/Rectangle/service/RectangleCloneService.js +13 -0
- package/src/Rectangle/service/RectangleContainsPointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleContainsPointService.js +16 -0
- package/src/Rectangle/service/RectangleContainsRectService.d.ts +12 -0
- package/src/Rectangle/service/RectangleContainsRectService.js +16 -0
- package/src/Rectangle/service/RectangleContainsService.d.ts +13 -0
- package/src/Rectangle/service/RectangleContainsService.js +17 -0
- package/src/Rectangle/service/RectangleCopyFromService.d.ts +12 -0
- package/src/Rectangle/service/RectangleCopyFromService.js +16 -0
- package/src/Rectangle/service/RectangleEqualsService.d.ts +12 -0
- package/src/Rectangle/service/RectangleEqualsService.js +16 -0
- package/src/Rectangle/service/RectangleInflatePointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleInflatePointService.js +16 -0
- package/src/Rectangle/service/RectangleInflateService.d.ts +13 -0
- package/src/Rectangle/service/RectangleInflateService.js +17 -0
- package/src/Rectangle/service/RectangleIntersectionService.d.ts +12 -0
- package/src/Rectangle/service/RectangleIntersectionService.js +22 -0
- package/src/Rectangle/service/RectangleIntersectsService.d.ts +12 -0
- package/src/Rectangle/service/RectangleIntersectsService.js +17 -0
- package/src/Rectangle/service/RectangleIsEmptyService.d.ts +11 -0
- package/src/Rectangle/service/RectangleIsEmptyService.js +12 -0
- package/src/Rectangle/service/RectangleOffsetPointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleOffsetPointService.js +14 -0
- package/src/Rectangle/service/RectangleOffsetService.d.ts +13 -0
- package/src/Rectangle/service/RectangleOffsetService.js +15 -0
- package/src/Rectangle/service/RectangleSetEmptyService.d.ts +11 -0
- package/src/Rectangle/service/RectangleSetEmptyService.js +12 -0
- package/src/Rectangle/service/RectangleSetToService.d.ts +15 -0
- package/src/Rectangle/service/RectangleSetToService.js +19 -0
- package/src/Rectangle/service/RectangleUnionService.d.ts +12 -0
- package/src/Rectangle/service/RectangleUnionService.js +20 -0
- package/{dist → src}/Rectangle.d.ts +50 -102
- package/{dist → src}/Rectangle.js +110 -205
- package/{dist → src}/index.d.ts +0 -1
- package/{dist → src}/index.js +0 -1
- package/dist/ColorTransform.js +0 -278
- package/dist/Transform.d.ts +0 -209
- package/dist/Transform.js +0 -478
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 指定のMatrixを連結
|
|
3
|
+
* Concatenate specified Matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix1
|
|
6
|
+
* @param {Matrix} matrix2
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const execute = (matrix1, matrix2) => {
|
|
12
|
+
const matrixArray1 = matrix1._$matrix;
|
|
13
|
+
const matrixArray2 = matrix2._$matrix;
|
|
14
|
+
let a = matrixArray1[0] * matrixArray2[0];
|
|
15
|
+
let b = 0.0;
|
|
16
|
+
let c = 0.0;
|
|
17
|
+
let d = matrixArray1[3] * matrixArray2[3];
|
|
18
|
+
let tx = matrixArray1[4] * matrixArray2[0] + matrixArray2[4];
|
|
19
|
+
let ty = matrixArray1[5] * matrixArray2[3] + matrixArray2[5];
|
|
20
|
+
if (matrixArray1[1] || matrixArray1[2] || matrixArray2[1] || matrixArray2[2]) {
|
|
21
|
+
a += matrixArray1[1] * matrixArray2[2];
|
|
22
|
+
d += matrixArray1[2] * matrixArray2[1];
|
|
23
|
+
b += matrixArray1[0] * matrixArray2[1] + matrixArray1[1] * matrixArray2[3];
|
|
24
|
+
c += matrixArray1[2] * matrixArray2[0] + matrixArray1[3] * matrixArray2[2];
|
|
25
|
+
tx += matrixArray1[5] * matrixArray2[2];
|
|
26
|
+
ty += matrixArray1[4] * matrixArray2[1];
|
|
27
|
+
}
|
|
28
|
+
matrixArray1[0] = a;
|
|
29
|
+
matrixArray1[1] = b;
|
|
30
|
+
matrixArray1[2] = c;
|
|
31
|
+
matrixArray1[3] = d;
|
|
32
|
+
matrixArray1[4] = tx;
|
|
33
|
+
matrixArray1[5] = ty;
|
|
34
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のMatrixオブジェクトのクローンを生成して返却
|
|
4
|
+
* Generate and return a clone of the specified Matrix object
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @return {Matrix}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (matrix: Matrix) => Matrix;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のMatrixオブジェクトのクローンを生成して返却
|
|
4
|
+
* Generate and return a clone of the specified Matrix object
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @return {Matrix}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const execute = (matrix) => {
|
|
12
|
+
return new Matrix(matrix._$matrix[0], matrix._$matrix[1], matrix._$matrix[2], matrix._$matrix[3], matrix._$matrix[4], matrix._$matrix[5]);
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のMatrixオブジェクトの値をコピー
|
|
4
|
+
* Copy the value of the specified Matrix object
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} dst
|
|
7
|
+
* @param {Matrix} src
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const execute: (dst: Matrix, src: Matrix) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 指定のMatrixオブジェクトの値をコピー
|
|
3
|
+
* Copy the value of the specified Matrix object
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} dst
|
|
6
|
+
* @param {Matrix} src
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const execute = (dst, src) => {
|
|
12
|
+
dst._$matrix[0] = src._$matrix[0];
|
|
13
|
+
dst._$matrix[1] = src._$matrix[1];
|
|
14
|
+
dst._$matrix[2] = src._$matrix[2];
|
|
15
|
+
dst._$matrix[3] = src._$matrix[3];
|
|
16
|
+
dst._$matrix[4] = src._$matrix[4];
|
|
17
|
+
dst._$matrix[5] = src._$matrix[5];
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @param {number} scale_x
|
|
7
|
+
* @param {number} scale_y
|
|
8
|
+
* @param {number} rotation
|
|
9
|
+
* @param {number} [tx=0]
|
|
10
|
+
* @param {number} [ty=0]
|
|
11
|
+
* @return {void}
|
|
12
|
+
* @method
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const execute: (matrix: Matrix, scale_x: number, scale_y: number, rotation?: number, tx?: number, ty?: number) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
*
|
|
4
|
+
* @param {Matrix} matrix
|
|
5
|
+
* @param {number} scale_x
|
|
6
|
+
* @param {number} scale_y
|
|
7
|
+
* @param {number} rotation
|
|
8
|
+
* @param {number} [tx=0]
|
|
9
|
+
* @param {number} [ty=0]
|
|
10
|
+
* @return {void}
|
|
11
|
+
* @method
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export const execute = (matrix, scale_x, scale_y, rotation = 0, tx = 0, ty = 0) => {
|
|
15
|
+
matrix.identity();
|
|
16
|
+
matrix.rotate(rotation);
|
|
17
|
+
matrix.scale(scale_x, scale_y);
|
|
18
|
+
matrix.translate(tx, ty);
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description Gradient用のMatrixを生成
|
|
4
|
+
* Create a Matrix for Gradient
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {number} width
|
|
8
|
+
* @param {number} height
|
|
9
|
+
* @param {number} [rotation=0]
|
|
10
|
+
* @param {number} [tx=0]
|
|
11
|
+
* @param {number} [ty=0]
|
|
12
|
+
* @return {void}
|
|
13
|
+
* @method
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare const execute: (matrix: Matrix, width: number, height: number, rotation?: number, tx?: number, ty?: number) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Gradient用のMatrixを生成
|
|
3
|
+
* Create a Matrix for Gradient
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @param {number} width
|
|
7
|
+
* @param {number} height
|
|
8
|
+
* @param {number} [rotation=0]
|
|
9
|
+
* @param {number} [tx=0]
|
|
10
|
+
* @param {number} [ty=0]
|
|
11
|
+
* @return {void}
|
|
12
|
+
* @method
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export const execute = (matrix, width, height, rotation = 0, tx = 0, ty = 0) => {
|
|
16
|
+
const array = matrix._$matrix;
|
|
17
|
+
array[0] = width / 1638.4;
|
|
18
|
+
array[3] = height / 1638.4;
|
|
19
|
+
if (rotation) {
|
|
20
|
+
const cos = Math.cos(rotation);
|
|
21
|
+
const sin = Math.sin(rotation);
|
|
22
|
+
array[1] = sin * array[3];
|
|
23
|
+
array[2] = -sin * array[0];
|
|
24
|
+
array[0] *= cos;
|
|
25
|
+
array[3] *= cos;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
array[1] = 0;
|
|
29
|
+
array[2] = 0;
|
|
30
|
+
}
|
|
31
|
+
array[4] = tx + width / 2;
|
|
32
|
+
array[5] = ty + height / 2;
|
|
33
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
import { Point } from "../../Point";
|
|
3
|
+
/**
|
|
4
|
+
* @description Matrixを使ってPointを変換
|
|
5
|
+
* Transform Point using Matrix
|
|
6
|
+
*
|
|
7
|
+
* @param {Matrix} matrix
|
|
8
|
+
* @param {Point} point
|
|
9
|
+
* @return {Point}
|
|
10
|
+
* @method
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const execute: (matrix: Matrix, point: Point) => Point;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Point } from "../../Point";
|
|
2
|
+
/**
|
|
3
|
+
* @description Matrixを使ってPointを変換
|
|
4
|
+
* Transform Point using Matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {Point} point
|
|
8
|
+
* @return {Point}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const execute = (matrix, point) => {
|
|
13
|
+
return new Point(point.x * matrix._$matrix[0] + point.y * matrix._$matrix[2], point.x * matrix._$matrix[1] + point.y * matrix._$matrix[3]);
|
|
14
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Matrixの値を初期化
|
|
3
|
+
* Initialize Matrix values
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @return {void}
|
|
7
|
+
* @method
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (matrix) => {
|
|
11
|
+
matrix._$matrix[0] = 1;
|
|
12
|
+
matrix._$matrix[1] = 0;
|
|
13
|
+
matrix._$matrix[2] = 0;
|
|
14
|
+
matrix._$matrix[3] = 1;
|
|
15
|
+
matrix._$matrix[4] = 0;
|
|
16
|
+
matrix._$matrix[5] = 0;
|
|
17
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description マトリックスを逆変換
|
|
3
|
+
* Invert the matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @return {void}
|
|
7
|
+
* @method
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (matrix) => {
|
|
11
|
+
const a = matrix._$matrix[0];
|
|
12
|
+
const b = matrix._$matrix[1];
|
|
13
|
+
const c = matrix._$matrix[2];
|
|
14
|
+
const d = matrix._$matrix[3];
|
|
15
|
+
const tx = matrix._$matrix[4];
|
|
16
|
+
const ty = matrix._$matrix[5];
|
|
17
|
+
if (b === 0 && c === 0) {
|
|
18
|
+
matrix._$matrix[0] = 1 / a;
|
|
19
|
+
matrix._$matrix[1] = 0;
|
|
20
|
+
matrix._$matrix[2] = 0;
|
|
21
|
+
matrix._$matrix[3] = 1 / d;
|
|
22
|
+
matrix._$matrix[4] = -matrix._$matrix[0] * tx;
|
|
23
|
+
matrix._$matrix[5] = -matrix._$matrix[3] * ty;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const det = a * d - b * c;
|
|
27
|
+
if (det) {
|
|
28
|
+
const rdet = 1 / det;
|
|
29
|
+
matrix._$matrix[0] = d * rdet;
|
|
30
|
+
matrix._$matrix[1] = -b * rdet;
|
|
31
|
+
matrix._$matrix[2] = -c * rdet;
|
|
32
|
+
matrix._$matrix[3] = a * rdet;
|
|
33
|
+
matrix._$matrix[4] = -(matrix._$matrix[0] * tx + matrix._$matrix[2] * ty);
|
|
34
|
+
matrix._$matrix[5] = -(matrix._$matrix[1] * tx + matrix._$matrix[3] * ty);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description マトリックスの回転変換
|
|
4
|
+
* Rotate transformation of matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (matrix: Matrix, rotation: number) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description マトリックスの回転変換
|
|
3
|
+
* Rotate transformation of matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @return {void}
|
|
7
|
+
* @method
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (matrix, rotation) => {
|
|
11
|
+
const array = matrix._$matrix;
|
|
12
|
+
const a = array[0];
|
|
13
|
+
const b = array[1];
|
|
14
|
+
const c = array[2];
|
|
15
|
+
const d = array[3];
|
|
16
|
+
const tx = array[4];
|
|
17
|
+
const ty = array[5];
|
|
18
|
+
array[0] = a * Math.cos(rotation) - b * Math.sin(rotation);
|
|
19
|
+
array[1] = a * Math.sin(rotation) + b * Math.cos(rotation);
|
|
20
|
+
array[2] = c * Math.cos(rotation) - d * Math.sin(rotation);
|
|
21
|
+
array[3] = c * Math.sin(rotation) + d * Math.cos(rotation);
|
|
22
|
+
array[4] = tx * Math.cos(rotation) - ty * Math.sin(rotation);
|
|
23
|
+
array[5] = tx * Math.sin(rotation) + ty * Math.cos(rotation);
|
|
24
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description マトリックスの拡大変換
|
|
4
|
+
* Scale transformation of matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {number} scale_x
|
|
8
|
+
* @param {number} scale_y
|
|
9
|
+
* @return {void}
|
|
10
|
+
* @method
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const execute: (matrix: Matrix, scale_x: number, scale_y: number) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description マトリックスの拡大変換
|
|
3
|
+
* Scale transformation of matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @param {number} scale_x
|
|
7
|
+
* @param {number} scale_y
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const execute = (matrix, scale_x, scale_y) => {
|
|
13
|
+
const array = matrix._$matrix;
|
|
14
|
+
array[0] *= scale_x;
|
|
15
|
+
array[2] *= scale_x;
|
|
16
|
+
array[4] *= scale_x;
|
|
17
|
+
array[1] *= scale_y;
|
|
18
|
+
array[3] *= scale_y;
|
|
19
|
+
array[5] *= scale_y;
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description マトリックスの設定変換
|
|
4
|
+
* Set transformation of matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {number} a
|
|
8
|
+
* @param {number} b
|
|
9
|
+
* @param {number} c
|
|
10
|
+
* @param {number} d
|
|
11
|
+
* @param {number} tx
|
|
12
|
+
* @param {number} ty
|
|
13
|
+
* @return {void}
|
|
14
|
+
* @method
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const execute: (matrix: Matrix, a: number, b: number, c: number, d: number, tx: number, ty: number) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description マトリックスの設定変換
|
|
3
|
+
* Set transformation of matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @param {number} a
|
|
7
|
+
* @param {number} b
|
|
8
|
+
* @param {number} c
|
|
9
|
+
* @param {number} d
|
|
10
|
+
* @param {number} tx
|
|
11
|
+
* @param {number} ty
|
|
12
|
+
* @return {void}
|
|
13
|
+
* @method
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export const execute = (matrix, a, b, c, d, tx, ty) => {
|
|
17
|
+
const array = matrix._$matrix;
|
|
18
|
+
array[0] = a;
|
|
19
|
+
array[1] = b;
|
|
20
|
+
array[2] = c;
|
|
21
|
+
array[3] = d;
|
|
22
|
+
array[4] = tx;
|
|
23
|
+
array[5] = ty;
|
|
24
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
import { Point } from "../../Point";
|
|
3
|
+
/**
|
|
4
|
+
* @description マトリックスの座標変換
|
|
5
|
+
* Coordinate transformation of matrix
|
|
6
|
+
*
|
|
7
|
+
* @param {Matrix} matrix
|
|
8
|
+
* @param {Point} point
|
|
9
|
+
* @return {void}
|
|
10
|
+
* @method
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const execute: (matrix: Matrix, point: Point) => Point;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Point } from "../../Point";
|
|
2
|
+
/**
|
|
3
|
+
* @description マトリックスの座標変換
|
|
4
|
+
* Coordinate transformation of matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {Point} point
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const execute = (matrix, point) => {
|
|
13
|
+
const x = point.x;
|
|
14
|
+
const y = point.y;
|
|
15
|
+
const array = matrix._$matrix;
|
|
16
|
+
return new Point(x * array[0] + y * array[2] + array[4], x * array[1] + y * array[3] + array[5]);
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description マトリックスの座標移動
|
|
4
|
+
* Coordinate movement of matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix
|
|
7
|
+
* @param {number} dx
|
|
8
|
+
* @param {number} dy
|
|
9
|
+
* @return {void}
|
|
10
|
+
* @method
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const execute: (matrix: Matrix, dx: number, dy: number) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description マトリックスの座標移動
|
|
3
|
+
* Coordinate movement of matrix
|
|
4
|
+
*
|
|
5
|
+
* @param {Matrix} matrix
|
|
6
|
+
* @param {number} dx
|
|
7
|
+
* @param {number} dy
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const execute = (matrix, dx, dy) => {
|
|
13
|
+
matrix.tx += dx;
|
|
14
|
+
matrix.ty += dy;
|
|
15
|
+
};
|
package/{dist → src}/Matrix.d.ts
RENAMED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { Point } from "./Point";
|
|
2
2
|
/**
|
|
3
|
-
* Matrix クラスは、2 つの座標空間の間におけるポイントのマッピング方法を決定する変換マトリックスを表します。
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* @description Matrix クラスは、2 つの座標空間の間におけるポイントのマッピング方法を決定する変換マトリックスを表します。
|
|
4
|
+
* Matrix オブジェクトのプロパティを設定し、Matrix オブジェクトを Transform オブジェクトの matrix プロパティに適用し、
|
|
5
|
+
* 次に Transform オブジェクトを表示オブジェクトの transform プロパティとして適用することで、表示オブジェクトに対する各種グラフィック変換を実行できます。
|
|
6
|
+
* これらの変換機能には、平行移動(x と y の位置変更)、回転、拡大 / 縮小、傾斜などが含まれます。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @example <caption>Example usage of Matrix.</caption>
|
|
15
|
-
* // new Matrix
|
|
16
|
-
* const {Matrix} = next2d.geom;
|
|
17
|
-
* const matrix = new Matrix();
|
|
18
|
-
* // set new Matrix
|
|
19
|
-
* const {MovieClip} = next2d.display;
|
|
20
|
-
* const movieClip = new MovieClip();
|
|
21
|
-
* movieClip.transform.matrix = matrix;
|
|
8
|
+
* The Matrix class represents a transformation matrix that determines how to map points from one coordinate space to another.
|
|
9
|
+
* You can perform various graphical transformations on a display object by setting the properties of a Matrix object,
|
|
10
|
+
* applying that Matrix object to the matrix property of a Transform object,
|
|
11
|
+
* and then applying that Transform object as the transform property of the display object.
|
|
12
|
+
* These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.
|
|
22
13
|
*
|
|
23
14
|
* @class
|
|
24
15
|
* @memberOf next2d.geom
|
|
@@ -37,45 +28,6 @@ export declare class Matrix {
|
|
|
37
28
|
* @public
|
|
38
29
|
*/
|
|
39
30
|
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
|
|
40
|
-
/**
|
|
41
|
-
* 指定されたクラスのストリングを返します。
|
|
42
|
-
* Returns the string representation of the specified class.
|
|
43
|
-
*
|
|
44
|
-
* @return {string}
|
|
45
|
-
* @default [class Matrix]
|
|
46
|
-
* @method
|
|
47
|
-
* @static
|
|
48
|
-
*/
|
|
49
|
-
static toString(): string;
|
|
50
|
-
/**
|
|
51
|
-
* @description 指定されたクラスの空間名を返します。
|
|
52
|
-
* Returns the space name of the specified class.
|
|
53
|
-
*
|
|
54
|
-
* @member {string}
|
|
55
|
-
* @default next2d.geom.Matrix
|
|
56
|
-
* @const
|
|
57
|
-
* @static
|
|
58
|
-
*/
|
|
59
|
-
static get namespace(): string;
|
|
60
|
-
/**
|
|
61
|
-
* @description 指定されたオブジェクトのストリングを返します。
|
|
62
|
-
* Returns the string representation of the specified object.
|
|
63
|
-
*
|
|
64
|
-
* @return {string}
|
|
65
|
-
* @method
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
toString(): string;
|
|
69
|
-
/**
|
|
70
|
-
* @description 指定されたオブジェクトの空間名を返します。
|
|
71
|
-
* Returns the space name of the specified object.
|
|
72
|
-
*
|
|
73
|
-
* @member {string}
|
|
74
|
-
* @default next2d.geom.Matrix
|
|
75
|
-
* @const
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
get namespace(): string;
|
|
79
31
|
/**
|
|
80
32
|
* @description イメージを拡大 / 縮小または回転するときに x 軸方向のピクセルの配置に影響を与える値です。
|
|
81
33
|
* The value that affects the positioning
|
|
@@ -141,11 +93,14 @@ export declare class Matrix {
|
|
|
141
93
|
get ty(): number;
|
|
142
94
|
set ty(ty: number);
|
|
143
95
|
/**
|
|
144
|
-
* @
|
|
145
|
-
*
|
|
146
|
-
*
|
|
96
|
+
* @description Matrixの内部Float32Arrayデータを返却
|
|
97
|
+
* Returns the internal Float32Array data of Matrix
|
|
98
|
+
*
|
|
99
|
+
* @member {Float32Array}
|
|
100
|
+
* @readonly
|
|
101
|
+
* @public
|
|
147
102
|
*/
|
|
148
|
-
|
|
103
|
+
get rawData(): Float32Array;
|
|
149
104
|
/**
|
|
150
105
|
* @description 新しい Matrix オブジェクトとして、このマトリックスのクローンを返します。
|
|
151
106
|
* 含まれるオブジェクトはまったく同じコピーになります。
|
|
@@ -163,21 +118,22 @@ export declare class Matrix {
|
|
|
163
118
|
* Concatenates a matrix with the current matrix,
|
|
164
119
|
* effectively combining the geometric effects of the two.
|
|
165
120
|
*
|
|
166
|
-
* @param {Matrix}
|
|
121
|
+
* @param {Matrix} matrix
|
|
167
122
|
* @return {void}
|
|
168
123
|
* @method
|
|
169
124
|
* @public
|
|
170
125
|
*/
|
|
171
|
-
concat(
|
|
126
|
+
concat(matrix: Matrix): void;
|
|
172
127
|
/**
|
|
173
128
|
* @description すべてのマトリックスデータを、ソース Matrix オブジェクトから、
|
|
174
129
|
* 呼び出し元の Matrix オブジェクトにコピーします。
|
|
175
130
|
*
|
|
176
|
-
* @param {Matrix}
|
|
177
|
-
* @method
|
|
131
|
+
* @param {Matrix} matrix
|
|
178
132
|
* @return {void}
|
|
133
|
+
* @method
|
|
134
|
+
* @public
|
|
179
135
|
*/
|
|
180
|
-
copyFrom(
|
|
136
|
+
copyFrom(matrix: Matrix): void;
|
|
181
137
|
/**
|
|
182
138
|
* @description 拡大 / 縮小、回転、平行移動に関するパラメーターなどがあります。
|
|
183
139
|
* Includes parameters for scaling, rotation, and translation.
|
|
@@ -250,13 +206,13 @@ export declare class Matrix {
|
|
|
250
206
|
* @description 行列に拡大 / 縮小の変換を適用します。
|
|
251
207
|
* Applies a scaling transformation to the matrix.
|
|
252
208
|
*
|
|
253
|
-
* @param {number}
|
|
254
|
-
* @param {number}
|
|
209
|
+
* @param {number} scale_x
|
|
210
|
+
* @param {number} scale_y
|
|
255
211
|
* @return {void}
|
|
256
212
|
* @method
|
|
257
213
|
* @public
|
|
258
214
|
*/
|
|
259
|
-
scale(
|
|
215
|
+
scale(scale_x: number, scale_y: number): void;
|
|
260
216
|
/**
|
|
261
217
|
* @description Matrix のメンバーを指定の値に設定します。
|
|
262
218
|
* Sets the members of Matrix to the specified values
|
|
@@ -296,4 +252,24 @@ export declare class Matrix {
|
|
|
296
252
|
* @public
|
|
297
253
|
*/
|
|
298
254
|
translate(dx: number, dy: number): void;
|
|
255
|
+
/**
|
|
256
|
+
* @description 指定された配列の値を乗算します
|
|
257
|
+
* Multiplies the value of the specified array.
|
|
258
|
+
*
|
|
259
|
+
* @param {Float32Array} a
|
|
260
|
+
* @param {Float32Array} b
|
|
261
|
+
* @return {Float32Array}
|
|
262
|
+
* @method
|
|
263
|
+
* @private
|
|
264
|
+
*/
|
|
265
|
+
static multiply(a: Float32Array, b: Float32Array): Float32Array;
|
|
266
|
+
/**
|
|
267
|
+
* @description 利用したFloat32Arrayを再利用する為にプールします。
|
|
268
|
+
* Pool the Float32Array used for reuse.
|
|
269
|
+
*
|
|
270
|
+
* @param {Float32Array} buffer
|
|
271
|
+
* @method
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
static release(buffer: Float32Array): void;
|
|
299
275
|
}
|