sdfsdfs
This commit is contained in:
18
node_modules/pixi.js/lib/maths/index.d.ts
generated
vendored
Normal file
18
node_modules/pixi.js/lib/maths/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export * from './matrix/groupD8';
|
||||
export * from './matrix/Matrix';
|
||||
export * from './misc/const';
|
||||
export * from './misc/pow2';
|
||||
export * from './misc/Size';
|
||||
export * from './misc/squaredDistanceToLineSegment';
|
||||
export * from './point/ObservablePoint';
|
||||
export * from './point/Point';
|
||||
export * from './point/PointData';
|
||||
export * from './point/pointInTriangle';
|
||||
export * from './point/PointLike';
|
||||
export * from './shapes/Circle';
|
||||
export * from './shapes/Ellipse';
|
||||
export * from './shapes/Polygon';
|
||||
export * from './shapes/Rectangle';
|
||||
export * from './shapes/RoundedRectangle';
|
||||
export * from './shapes/ShapePrimitive';
|
||||
export * from './shapes/Triangle';
|
42
node_modules/pixi.js/lib/maths/index.js
generated
vendored
Normal file
42
node_modules/pixi.js/lib/maths/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
var groupD8 = require('./matrix/groupD8.js');
|
||||
var Matrix = require('./matrix/Matrix.js');
|
||||
var _const = require('./misc/const.js');
|
||||
var pow2 = require('./misc/pow2.js');
|
||||
require('./misc/Size.js');
|
||||
var squaredDistanceToLineSegment = require('./misc/squaredDistanceToLineSegment.js');
|
||||
var ObservablePoint = require('./point/ObservablePoint.js');
|
||||
var Point = require('./point/Point.js');
|
||||
require('./point/PointData.js');
|
||||
var pointInTriangle = require('./point/pointInTriangle.js');
|
||||
require('./point/PointLike.js');
|
||||
var Circle = require('./shapes/Circle.js');
|
||||
var Ellipse = require('./shapes/Ellipse.js');
|
||||
var Polygon = require('./shapes/Polygon.js');
|
||||
var Rectangle = require('./shapes/Rectangle.js');
|
||||
var RoundedRectangle = require('./shapes/RoundedRectangle.js');
|
||||
require('./shapes/ShapePrimitive.js');
|
||||
var Triangle = require('./shapes/Triangle.js');
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.groupD8 = groupD8.groupD8;
|
||||
exports.Matrix = Matrix.Matrix;
|
||||
exports.DEG_TO_RAD = _const.DEG_TO_RAD;
|
||||
exports.PI_2 = _const.PI_2;
|
||||
exports.RAD_TO_DEG = _const.RAD_TO_DEG;
|
||||
exports.isPow2 = pow2.isPow2;
|
||||
exports.log2 = pow2.log2;
|
||||
exports.nextPow2 = pow2.nextPow2;
|
||||
exports.squaredDistanceToLineSegment = squaredDistanceToLineSegment.squaredDistanceToLineSegment;
|
||||
exports.ObservablePoint = ObservablePoint.ObservablePoint;
|
||||
exports.Point = Point.Point;
|
||||
exports.pointInTriangle = pointInTriangle.pointInTriangle;
|
||||
exports.Circle = Circle.Circle;
|
||||
exports.Ellipse = Ellipse.Ellipse;
|
||||
exports.Polygon = Polygon.Polygon;
|
||||
exports.Rectangle = Rectangle.Rectangle;
|
||||
exports.RoundedRectangle = RoundedRectangle.RoundedRectangle;
|
||||
exports.Triangle = Triangle.Triangle;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/pixi.js/lib/maths/index.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
21
node_modules/pixi.js/lib/maths/index.mjs
generated
vendored
Normal file
21
node_modules/pixi.js/lib/maths/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export { groupD8 } from './matrix/groupD8.mjs';
|
||||
export { Matrix } from './matrix/Matrix.mjs';
|
||||
export { DEG_TO_RAD, PI_2, RAD_TO_DEG } from './misc/const.mjs';
|
||||
export { isPow2, log2, nextPow2 } from './misc/pow2.mjs';
|
||||
import './misc/Size.mjs';
|
||||
export { squaredDistanceToLineSegment } from './misc/squaredDistanceToLineSegment.mjs';
|
||||
export { ObservablePoint } from './point/ObservablePoint.mjs';
|
||||
export { Point } from './point/Point.mjs';
|
||||
import './point/PointData.mjs';
|
||||
export { pointInTriangle } from './point/pointInTriangle.mjs';
|
||||
import './point/PointLike.mjs';
|
||||
export { Circle } from './shapes/Circle.mjs';
|
||||
export { Ellipse } from './shapes/Ellipse.mjs';
|
||||
export { Polygon } from './shapes/Polygon.mjs';
|
||||
export { Rectangle } from './shapes/Rectangle.mjs';
|
||||
export { RoundedRectangle } from './shapes/RoundedRectangle.mjs';
|
||||
import './shapes/ShapePrimitive.mjs';
|
||||
export { Triangle } from './shapes/Triangle.mjs';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=index.mjs.map
|
1
node_modules/pixi.js/lib/maths/index.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
199
node_modules/pixi.js/lib/maths/matrix/Matrix.d.ts
generated
vendored
Normal file
199
node_modules/pixi.js/lib/maths/matrix/Matrix.d.ts
generated
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
import { Point } from '../point/Point';
|
||||
import type { PointData } from '../point/PointData';
|
||||
interface TransformableObject {
|
||||
position: PointData;
|
||||
scale: PointData;
|
||||
pivot: PointData;
|
||||
skew: PointData;
|
||||
rotation: number;
|
||||
}
|
||||
/**
|
||||
* A fast matrix for 2D transformations.
|
||||
* ```js
|
||||
* | a | c | tx|
|
||||
* | b | d | ty|
|
||||
* | 0 | 0 | 1 |
|
||||
* ```
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Matrix {
|
||||
/** @default 1 */
|
||||
a: number;
|
||||
/** @default 0 */
|
||||
b: number;
|
||||
/** @default 0 */
|
||||
c: number;
|
||||
/** @default 1 */
|
||||
d: number;
|
||||
/** @default 0 */
|
||||
tx: number;
|
||||
/** @default 0 */
|
||||
ty: number;
|
||||
/** An array of the current matrix. Only populated when `toArray` is called */
|
||||
array: Float32Array | null;
|
||||
/**
|
||||
* @param a - x scale
|
||||
* @param b - y skew
|
||||
* @param c - x skew
|
||||
* @param d - y scale
|
||||
* @param tx - x translation
|
||||
* @param ty - y translation
|
||||
*/
|
||||
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
|
||||
/**
|
||||
* Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:
|
||||
*
|
||||
* a = array[0]
|
||||
* b = array[1]
|
||||
* c = array[3]
|
||||
* d = array[4]
|
||||
* tx = array[2]
|
||||
* ty = array[5]
|
||||
* @param array - The array that the matrix will be populated from.
|
||||
*/
|
||||
fromArray(array: number[]): void;
|
||||
/**
|
||||
* Sets the matrix properties.
|
||||
* @param a - Matrix component
|
||||
* @param b - Matrix component
|
||||
* @param c - Matrix component
|
||||
* @param d - Matrix component
|
||||
* @param tx - Matrix component
|
||||
* @param ty - Matrix component
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
set(a: number, b: number, c: number, d: number, tx: number, ty: number): this;
|
||||
/**
|
||||
* Creates an array from the current Matrix object.
|
||||
* @param transpose - Whether we need to transpose the matrix or not
|
||||
* @param [out=new Float32Array(9)] - If provided the array will be assigned to out
|
||||
* @returns The newly created array which contains the matrix
|
||||
*/
|
||||
toArray(transpose?: boolean, out?: Float32Array): Float32Array;
|
||||
/**
|
||||
* Get a new position with the current transformation applied.
|
||||
* Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, transformed through this matrix
|
||||
*/
|
||||
apply<P extends PointData = Point>(pos: PointData, newPos?: P): P;
|
||||
/**
|
||||
* Get a new position with the inverse of the current transformation applied.
|
||||
* Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, inverse-transformed through this matrix
|
||||
*/
|
||||
applyInverse<P extends PointData = Point>(pos: PointData, newPos?: P): P;
|
||||
/**
|
||||
* Translates the matrix on the x and y.
|
||||
* @param x - How much to translate x by
|
||||
* @param y - How much to translate y by
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
translate(x: number, y: number): this;
|
||||
/**
|
||||
* Applies a scale transformation to the matrix.
|
||||
* @param x - The amount to scale horizontally
|
||||
* @param y - The amount to scale vertically
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
scale(x: number, y: number): this;
|
||||
/**
|
||||
* Applies a rotation transformation to the matrix.
|
||||
* @param angle - The angle in radians.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
rotate(angle: number): this;
|
||||
/**
|
||||
* Appends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
append(matrix: Matrix): this;
|
||||
/**
|
||||
* Appends two matrix's and sets the result to this matrix. AB = A * B
|
||||
* @param a - The matrix to append.
|
||||
* @param b - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
appendFrom(a: Matrix, b: Matrix): this;
|
||||
/**
|
||||
* Sets the matrix based on all the available properties
|
||||
* @param x - Position on the x axis
|
||||
* @param y - Position on the y axis
|
||||
* @param pivotX - Pivot on the x axis
|
||||
* @param pivotY - Pivot on the y axis
|
||||
* @param scaleX - Scale on the x axis
|
||||
* @param scaleY - Scale on the y axis
|
||||
* @param rotation - Rotation in radians
|
||||
* @param skewX - Skew on the x axis
|
||||
* @param skewY - Skew on the y axis
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): this;
|
||||
/**
|
||||
* Prepends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to prepend
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
prepend(matrix: Matrix): this;
|
||||
/**
|
||||
* Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
|
||||
* @param transform - The transform to apply the properties to.
|
||||
* @returns The transform with the newly applied properties
|
||||
*/
|
||||
decompose(transform: TransformableObject): TransformableObject;
|
||||
/**
|
||||
* Inverts this matrix
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
invert(): this;
|
||||
/** Checks if this matrix is an identity matrix */
|
||||
isIdentity(): boolean;
|
||||
/**
|
||||
* Resets this Matrix to an identity (default) matrix.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
identity(): this;
|
||||
/**
|
||||
* Creates a new Matrix object with the same values as this one.
|
||||
* @returns A copy of this matrix. Good for chaining method calls.
|
||||
*/
|
||||
clone(): Matrix;
|
||||
/**
|
||||
* Changes the values of the given matrix to be the same as the ones in this matrix
|
||||
* @param matrix - The matrix to copy to.
|
||||
* @returns The matrix given in parameter with its values updated.
|
||||
*/
|
||||
copyTo(matrix: Matrix): Matrix;
|
||||
/**
|
||||
* Changes the values of the matrix to be the same as the ones in given matrix
|
||||
* @param matrix - The matrix to copy from.
|
||||
* @returns this
|
||||
*/
|
||||
copyFrom(matrix: Matrix): this;
|
||||
/**
|
||||
* check to see if two matrices are the same
|
||||
* @param matrix - The matrix to compare to.
|
||||
*/
|
||||
equals(matrix: Matrix): boolean;
|
||||
toString(): string;
|
||||
/**
|
||||
* A default (identity) matrix.
|
||||
*
|
||||
* This is a shared object, if you want to modify it consider creating a new `Matrix`
|
||||
* @readonly
|
||||
*/
|
||||
static get IDENTITY(): Readonly<Matrix>;
|
||||
/**
|
||||
* A static Matrix that can be used to avoid creating new objects.
|
||||
* Will always ensure the matrix is reset to identity when requested.
|
||||
* Use this object for fast but temporary calculations, as it may be mutated later on.
|
||||
* This is a different object to the `IDENTITY` object and so can be modified without changing `IDENTITY`.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared(): Matrix;
|
||||
}
|
||||
export {};
|
404
node_modules/pixi.js/lib/maths/matrix/Matrix.js
generated
vendored
Normal file
404
node_modules/pixi.js/lib/maths/matrix/Matrix.js
generated
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
'use strict';
|
||||
|
||||
var _const = require('../misc/const.js');
|
||||
var Point = require('../point/Point.js');
|
||||
|
||||
"use strict";
|
||||
class Matrix {
|
||||
/**
|
||||
* @param a - x scale
|
||||
* @param b - y skew
|
||||
* @param c - x skew
|
||||
* @param d - y scale
|
||||
* @param tx - x translation
|
||||
* @param ty - y translation
|
||||
*/
|
||||
constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
|
||||
/** An array of the current matrix. Only populated when `toArray` is called */
|
||||
this.array = null;
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.tx = tx;
|
||||
this.ty = ty;
|
||||
}
|
||||
/**
|
||||
* Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:
|
||||
*
|
||||
* a = array[0]
|
||||
* b = array[1]
|
||||
* c = array[3]
|
||||
* d = array[4]
|
||||
* tx = array[2]
|
||||
* ty = array[5]
|
||||
* @param array - The array that the matrix will be populated from.
|
||||
*/
|
||||
fromArray(array) {
|
||||
this.a = array[0];
|
||||
this.b = array[1];
|
||||
this.c = array[3];
|
||||
this.d = array[4];
|
||||
this.tx = array[2];
|
||||
this.ty = array[5];
|
||||
}
|
||||
/**
|
||||
* Sets the matrix properties.
|
||||
* @param a - Matrix component
|
||||
* @param b - Matrix component
|
||||
* @param c - Matrix component
|
||||
* @param d - Matrix component
|
||||
* @param tx - Matrix component
|
||||
* @param ty - Matrix component
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
set(a, b, c, d, tx, ty) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.tx = tx;
|
||||
this.ty = ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Creates an array from the current Matrix object.
|
||||
* @param transpose - Whether we need to transpose the matrix or not
|
||||
* @param [out=new Float32Array(9)] - If provided the array will be assigned to out
|
||||
* @returns The newly created array which contains the matrix
|
||||
*/
|
||||
toArray(transpose, out) {
|
||||
if (!this.array) {
|
||||
this.array = new Float32Array(9);
|
||||
}
|
||||
const array = out || this.array;
|
||||
if (transpose) {
|
||||
array[0] = this.a;
|
||||
array[1] = this.b;
|
||||
array[2] = 0;
|
||||
array[3] = this.c;
|
||||
array[4] = this.d;
|
||||
array[5] = 0;
|
||||
array[6] = this.tx;
|
||||
array[7] = this.ty;
|
||||
array[8] = 1;
|
||||
} else {
|
||||
array[0] = this.a;
|
||||
array[1] = this.c;
|
||||
array[2] = this.tx;
|
||||
array[3] = this.b;
|
||||
array[4] = this.d;
|
||||
array[5] = this.ty;
|
||||
array[6] = 0;
|
||||
array[7] = 0;
|
||||
array[8] = 1;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
/**
|
||||
* Get a new position with the current transformation applied.
|
||||
* Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, transformed through this matrix
|
||||
*/
|
||||
apply(pos, newPos) {
|
||||
newPos = newPos || new Point.Point();
|
||||
const x = pos.x;
|
||||
const y = pos.y;
|
||||
newPos.x = this.a * x + this.c * y + this.tx;
|
||||
newPos.y = this.b * x + this.d * y + this.ty;
|
||||
return newPos;
|
||||
}
|
||||
/**
|
||||
* Get a new position with the inverse of the current transformation applied.
|
||||
* Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, inverse-transformed through this matrix
|
||||
*/
|
||||
applyInverse(pos, newPos) {
|
||||
newPos = newPos || new Point.Point();
|
||||
const a = this.a;
|
||||
const b = this.b;
|
||||
const c = this.c;
|
||||
const d = this.d;
|
||||
const tx = this.tx;
|
||||
const ty = this.ty;
|
||||
const id = 1 / (a * d + c * -b);
|
||||
const x = pos.x;
|
||||
const y = pos.y;
|
||||
newPos.x = d * id * x + -c * id * y + (ty * c - tx * d) * id;
|
||||
newPos.y = a * id * y + -b * id * x + (-ty * a + tx * b) * id;
|
||||
return newPos;
|
||||
}
|
||||
/**
|
||||
* Translates the matrix on the x and y.
|
||||
* @param x - How much to translate x by
|
||||
* @param y - How much to translate y by
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
translate(x, y) {
|
||||
this.tx += x;
|
||||
this.ty += y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Applies a scale transformation to the matrix.
|
||||
* @param x - The amount to scale horizontally
|
||||
* @param y - The amount to scale vertically
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
scale(x, y) {
|
||||
this.a *= x;
|
||||
this.d *= y;
|
||||
this.c *= x;
|
||||
this.b *= y;
|
||||
this.tx *= x;
|
||||
this.ty *= y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Applies a rotation transformation to the matrix.
|
||||
* @param angle - The angle in radians.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
rotate(angle) {
|
||||
const cos = Math.cos(angle);
|
||||
const sin = Math.sin(angle);
|
||||
const a1 = this.a;
|
||||
const c1 = this.c;
|
||||
const tx1 = this.tx;
|
||||
this.a = a1 * cos - this.b * sin;
|
||||
this.b = a1 * sin + this.b * cos;
|
||||
this.c = c1 * cos - this.d * sin;
|
||||
this.d = c1 * sin + this.d * cos;
|
||||
this.tx = tx1 * cos - this.ty * sin;
|
||||
this.ty = tx1 * sin + this.ty * cos;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Appends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
append(matrix) {
|
||||
const a1 = this.a;
|
||||
const b1 = this.b;
|
||||
const c1 = this.c;
|
||||
const d1 = this.d;
|
||||
this.a = matrix.a * a1 + matrix.b * c1;
|
||||
this.b = matrix.a * b1 + matrix.b * d1;
|
||||
this.c = matrix.c * a1 + matrix.d * c1;
|
||||
this.d = matrix.c * b1 + matrix.d * d1;
|
||||
this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx;
|
||||
this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Appends two matrix's and sets the result to this matrix. AB = A * B
|
||||
* @param a - The matrix to append.
|
||||
* @param b - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
appendFrom(a, b) {
|
||||
const a1 = a.a;
|
||||
const b1 = a.b;
|
||||
const c1 = a.c;
|
||||
const d1 = a.d;
|
||||
const tx = a.tx;
|
||||
const ty = a.ty;
|
||||
const a2 = b.a;
|
||||
const b2 = b.b;
|
||||
const c2 = b.c;
|
||||
const d2 = b.d;
|
||||
this.a = a1 * a2 + b1 * c2;
|
||||
this.b = a1 * b2 + b1 * d2;
|
||||
this.c = c1 * a2 + d1 * c2;
|
||||
this.d = c1 * b2 + d1 * d2;
|
||||
this.tx = tx * a2 + ty * c2 + b.tx;
|
||||
this.ty = tx * b2 + ty * d2 + b.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets the matrix based on all the available properties
|
||||
* @param x - Position on the x axis
|
||||
* @param y - Position on the y axis
|
||||
* @param pivotX - Pivot on the x axis
|
||||
* @param pivotY - Pivot on the y axis
|
||||
* @param scaleX - Scale on the x axis
|
||||
* @param scaleY - Scale on the y axis
|
||||
* @param rotation - Rotation in radians
|
||||
* @param skewX - Skew on the x axis
|
||||
* @param skewY - Skew on the y axis
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {
|
||||
this.a = Math.cos(rotation + skewY) * scaleX;
|
||||
this.b = Math.sin(rotation + skewY) * scaleX;
|
||||
this.c = -Math.sin(rotation - skewX) * scaleY;
|
||||
this.d = Math.cos(rotation - skewX) * scaleY;
|
||||
this.tx = x - (pivotX * this.a + pivotY * this.c);
|
||||
this.ty = y - (pivotX * this.b + pivotY * this.d);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Prepends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to prepend
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
prepend(matrix) {
|
||||
const tx1 = this.tx;
|
||||
if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {
|
||||
const a1 = this.a;
|
||||
const c1 = this.c;
|
||||
this.a = a1 * matrix.a + this.b * matrix.c;
|
||||
this.b = a1 * matrix.b + this.b * matrix.d;
|
||||
this.c = c1 * matrix.a + this.d * matrix.c;
|
||||
this.d = c1 * matrix.b + this.d * matrix.d;
|
||||
}
|
||||
this.tx = tx1 * matrix.a + this.ty * matrix.c + matrix.tx;
|
||||
this.ty = tx1 * matrix.b + this.ty * matrix.d + matrix.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
|
||||
* @param transform - The transform to apply the properties to.
|
||||
* @returns The transform with the newly applied properties
|
||||
*/
|
||||
decompose(transform) {
|
||||
const a = this.a;
|
||||
const b = this.b;
|
||||
const c = this.c;
|
||||
const d = this.d;
|
||||
const pivot = transform.pivot;
|
||||
const skewX = -Math.atan2(-c, d);
|
||||
const skewY = Math.atan2(b, a);
|
||||
const delta = Math.abs(skewX + skewY);
|
||||
if (delta < 1e-5 || Math.abs(_const.PI_2 - delta) < 1e-5) {
|
||||
transform.rotation = skewY;
|
||||
transform.skew.x = transform.skew.y = 0;
|
||||
} else {
|
||||
transform.rotation = 0;
|
||||
transform.skew.x = skewX;
|
||||
transform.skew.y = skewY;
|
||||
}
|
||||
transform.scale.x = Math.sqrt(a * a + b * b);
|
||||
transform.scale.y = Math.sqrt(c * c + d * d);
|
||||
transform.position.x = this.tx + (pivot.x * a + pivot.y * c);
|
||||
transform.position.y = this.ty + (pivot.x * b + pivot.y * d);
|
||||
return transform;
|
||||
}
|
||||
/**
|
||||
* Inverts this matrix
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
invert() {
|
||||
const a1 = this.a;
|
||||
const b1 = this.b;
|
||||
const c1 = this.c;
|
||||
const d1 = this.d;
|
||||
const tx1 = this.tx;
|
||||
const n = a1 * d1 - b1 * c1;
|
||||
this.a = d1 / n;
|
||||
this.b = -b1 / n;
|
||||
this.c = -c1 / n;
|
||||
this.d = a1 / n;
|
||||
this.tx = (c1 * this.ty - d1 * tx1) / n;
|
||||
this.ty = -(a1 * this.ty - b1 * tx1) / n;
|
||||
return this;
|
||||
}
|
||||
/** Checks if this matrix is an identity matrix */
|
||||
isIdentity() {
|
||||
return this.a === 1 && this.b === 0 && this.c === 0 && this.d === 1 && this.tx === 0 && this.ty === 0;
|
||||
}
|
||||
/**
|
||||
* Resets this Matrix to an identity (default) matrix.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
identity() {
|
||||
this.a = 1;
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
this.d = 1;
|
||||
this.tx = 0;
|
||||
this.ty = 0;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Creates a new Matrix object with the same values as this one.
|
||||
* @returns A copy of this matrix. Good for chaining method calls.
|
||||
*/
|
||||
clone() {
|
||||
const matrix = new Matrix();
|
||||
matrix.a = this.a;
|
||||
matrix.b = this.b;
|
||||
matrix.c = this.c;
|
||||
matrix.d = this.d;
|
||||
matrix.tx = this.tx;
|
||||
matrix.ty = this.ty;
|
||||
return matrix;
|
||||
}
|
||||
/**
|
||||
* Changes the values of the given matrix to be the same as the ones in this matrix
|
||||
* @param matrix - The matrix to copy to.
|
||||
* @returns The matrix given in parameter with its values updated.
|
||||
*/
|
||||
copyTo(matrix) {
|
||||
matrix.a = this.a;
|
||||
matrix.b = this.b;
|
||||
matrix.c = this.c;
|
||||
matrix.d = this.d;
|
||||
matrix.tx = this.tx;
|
||||
matrix.ty = this.ty;
|
||||
return matrix;
|
||||
}
|
||||
/**
|
||||
* Changes the values of the matrix to be the same as the ones in given matrix
|
||||
* @param matrix - The matrix to copy from.
|
||||
* @returns this
|
||||
*/
|
||||
copyFrom(matrix) {
|
||||
this.a = matrix.a;
|
||||
this.b = matrix.b;
|
||||
this.c = matrix.c;
|
||||
this.d = matrix.d;
|
||||
this.tx = matrix.tx;
|
||||
this.ty = matrix.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* check to see if two matrices are the same
|
||||
* @param matrix - The matrix to compare to.
|
||||
*/
|
||||
equals(matrix) {
|
||||
return matrix.a === this.a && matrix.b === this.b && matrix.c === this.c && matrix.d === this.d && matrix.tx === this.tx && matrix.ty === this.ty;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;
|
||||
}
|
||||
/**
|
||||
* A default (identity) matrix.
|
||||
*
|
||||
* This is a shared object, if you want to modify it consider creating a new `Matrix`
|
||||
* @readonly
|
||||
*/
|
||||
static get IDENTITY() {
|
||||
return identityMatrix.identity();
|
||||
}
|
||||
/**
|
||||
* A static Matrix that can be used to avoid creating new objects.
|
||||
* Will always ensure the matrix is reset to identity when requested.
|
||||
* Use this object for fast but temporary calculations, as it may be mutated later on.
|
||||
* This is a different object to the `IDENTITY` object and so can be modified without changing `IDENTITY`.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared() {
|
||||
return tempMatrix.identity();
|
||||
}
|
||||
}
|
||||
const tempMatrix = new Matrix();
|
||||
const identityMatrix = new Matrix();
|
||||
|
||||
exports.Matrix = Matrix;
|
||||
//# sourceMappingURL=Matrix.js.map
|
1
node_modules/pixi.js/lib/maths/matrix/Matrix.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/matrix/Matrix.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
402
node_modules/pixi.js/lib/maths/matrix/Matrix.mjs
generated
vendored
Normal file
402
node_modules/pixi.js/lib/maths/matrix/Matrix.mjs
generated
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
import { PI_2 } from '../misc/const.mjs';
|
||||
import { Point } from '../point/Point.mjs';
|
||||
|
||||
"use strict";
|
||||
class Matrix {
|
||||
/**
|
||||
* @param a - x scale
|
||||
* @param b - y skew
|
||||
* @param c - x skew
|
||||
* @param d - y scale
|
||||
* @param tx - x translation
|
||||
* @param ty - y translation
|
||||
*/
|
||||
constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
|
||||
/** An array of the current matrix. Only populated when `toArray` is called */
|
||||
this.array = null;
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.tx = tx;
|
||||
this.ty = ty;
|
||||
}
|
||||
/**
|
||||
* Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:
|
||||
*
|
||||
* a = array[0]
|
||||
* b = array[1]
|
||||
* c = array[3]
|
||||
* d = array[4]
|
||||
* tx = array[2]
|
||||
* ty = array[5]
|
||||
* @param array - The array that the matrix will be populated from.
|
||||
*/
|
||||
fromArray(array) {
|
||||
this.a = array[0];
|
||||
this.b = array[1];
|
||||
this.c = array[3];
|
||||
this.d = array[4];
|
||||
this.tx = array[2];
|
||||
this.ty = array[5];
|
||||
}
|
||||
/**
|
||||
* Sets the matrix properties.
|
||||
* @param a - Matrix component
|
||||
* @param b - Matrix component
|
||||
* @param c - Matrix component
|
||||
* @param d - Matrix component
|
||||
* @param tx - Matrix component
|
||||
* @param ty - Matrix component
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
set(a, b, c, d, tx, ty) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.tx = tx;
|
||||
this.ty = ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Creates an array from the current Matrix object.
|
||||
* @param transpose - Whether we need to transpose the matrix or not
|
||||
* @param [out=new Float32Array(9)] - If provided the array will be assigned to out
|
||||
* @returns The newly created array which contains the matrix
|
||||
*/
|
||||
toArray(transpose, out) {
|
||||
if (!this.array) {
|
||||
this.array = new Float32Array(9);
|
||||
}
|
||||
const array = out || this.array;
|
||||
if (transpose) {
|
||||
array[0] = this.a;
|
||||
array[1] = this.b;
|
||||
array[2] = 0;
|
||||
array[3] = this.c;
|
||||
array[4] = this.d;
|
||||
array[5] = 0;
|
||||
array[6] = this.tx;
|
||||
array[7] = this.ty;
|
||||
array[8] = 1;
|
||||
} else {
|
||||
array[0] = this.a;
|
||||
array[1] = this.c;
|
||||
array[2] = this.tx;
|
||||
array[3] = this.b;
|
||||
array[4] = this.d;
|
||||
array[5] = this.ty;
|
||||
array[6] = 0;
|
||||
array[7] = 0;
|
||||
array[8] = 1;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
/**
|
||||
* Get a new position with the current transformation applied.
|
||||
* Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, transformed through this matrix
|
||||
*/
|
||||
apply(pos, newPos) {
|
||||
newPos = newPos || new Point();
|
||||
const x = pos.x;
|
||||
const y = pos.y;
|
||||
newPos.x = this.a * x + this.c * y + this.tx;
|
||||
newPos.y = this.b * x + this.d * y + this.ty;
|
||||
return newPos;
|
||||
}
|
||||
/**
|
||||
* Get a new position with the inverse of the current transformation applied.
|
||||
* Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
|
||||
* @param pos - The origin
|
||||
* @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
|
||||
* @returns {Point} The new point, inverse-transformed through this matrix
|
||||
*/
|
||||
applyInverse(pos, newPos) {
|
||||
newPos = newPos || new Point();
|
||||
const a = this.a;
|
||||
const b = this.b;
|
||||
const c = this.c;
|
||||
const d = this.d;
|
||||
const tx = this.tx;
|
||||
const ty = this.ty;
|
||||
const id = 1 / (a * d + c * -b);
|
||||
const x = pos.x;
|
||||
const y = pos.y;
|
||||
newPos.x = d * id * x + -c * id * y + (ty * c - tx * d) * id;
|
||||
newPos.y = a * id * y + -b * id * x + (-ty * a + tx * b) * id;
|
||||
return newPos;
|
||||
}
|
||||
/**
|
||||
* Translates the matrix on the x and y.
|
||||
* @param x - How much to translate x by
|
||||
* @param y - How much to translate y by
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
translate(x, y) {
|
||||
this.tx += x;
|
||||
this.ty += y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Applies a scale transformation to the matrix.
|
||||
* @param x - The amount to scale horizontally
|
||||
* @param y - The amount to scale vertically
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
scale(x, y) {
|
||||
this.a *= x;
|
||||
this.d *= y;
|
||||
this.c *= x;
|
||||
this.b *= y;
|
||||
this.tx *= x;
|
||||
this.ty *= y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Applies a rotation transformation to the matrix.
|
||||
* @param angle - The angle in radians.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
rotate(angle) {
|
||||
const cos = Math.cos(angle);
|
||||
const sin = Math.sin(angle);
|
||||
const a1 = this.a;
|
||||
const c1 = this.c;
|
||||
const tx1 = this.tx;
|
||||
this.a = a1 * cos - this.b * sin;
|
||||
this.b = a1 * sin + this.b * cos;
|
||||
this.c = c1 * cos - this.d * sin;
|
||||
this.d = c1 * sin + this.d * cos;
|
||||
this.tx = tx1 * cos - this.ty * sin;
|
||||
this.ty = tx1 * sin + this.ty * cos;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Appends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
append(matrix) {
|
||||
const a1 = this.a;
|
||||
const b1 = this.b;
|
||||
const c1 = this.c;
|
||||
const d1 = this.d;
|
||||
this.a = matrix.a * a1 + matrix.b * c1;
|
||||
this.b = matrix.a * b1 + matrix.b * d1;
|
||||
this.c = matrix.c * a1 + matrix.d * c1;
|
||||
this.d = matrix.c * b1 + matrix.d * d1;
|
||||
this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx;
|
||||
this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Appends two matrix's and sets the result to this matrix. AB = A * B
|
||||
* @param a - The matrix to append.
|
||||
* @param b - The matrix to append.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
appendFrom(a, b) {
|
||||
const a1 = a.a;
|
||||
const b1 = a.b;
|
||||
const c1 = a.c;
|
||||
const d1 = a.d;
|
||||
const tx = a.tx;
|
||||
const ty = a.ty;
|
||||
const a2 = b.a;
|
||||
const b2 = b.b;
|
||||
const c2 = b.c;
|
||||
const d2 = b.d;
|
||||
this.a = a1 * a2 + b1 * c2;
|
||||
this.b = a1 * b2 + b1 * d2;
|
||||
this.c = c1 * a2 + d1 * c2;
|
||||
this.d = c1 * b2 + d1 * d2;
|
||||
this.tx = tx * a2 + ty * c2 + b.tx;
|
||||
this.ty = tx * b2 + ty * d2 + b.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets the matrix based on all the available properties
|
||||
* @param x - Position on the x axis
|
||||
* @param y - Position on the y axis
|
||||
* @param pivotX - Pivot on the x axis
|
||||
* @param pivotY - Pivot on the y axis
|
||||
* @param scaleX - Scale on the x axis
|
||||
* @param scaleY - Scale on the y axis
|
||||
* @param rotation - Rotation in radians
|
||||
* @param skewX - Skew on the x axis
|
||||
* @param skewY - Skew on the y axis
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {
|
||||
this.a = Math.cos(rotation + skewY) * scaleX;
|
||||
this.b = Math.sin(rotation + skewY) * scaleX;
|
||||
this.c = -Math.sin(rotation - skewX) * scaleY;
|
||||
this.d = Math.cos(rotation - skewX) * scaleY;
|
||||
this.tx = x - (pivotX * this.a + pivotY * this.c);
|
||||
this.ty = y - (pivotX * this.b + pivotY * this.d);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Prepends the given Matrix to this Matrix.
|
||||
* @param matrix - The matrix to prepend
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
prepend(matrix) {
|
||||
const tx1 = this.tx;
|
||||
if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {
|
||||
const a1 = this.a;
|
||||
const c1 = this.c;
|
||||
this.a = a1 * matrix.a + this.b * matrix.c;
|
||||
this.b = a1 * matrix.b + this.b * matrix.d;
|
||||
this.c = c1 * matrix.a + this.d * matrix.c;
|
||||
this.d = c1 * matrix.b + this.d * matrix.d;
|
||||
}
|
||||
this.tx = tx1 * matrix.a + this.ty * matrix.c + matrix.tx;
|
||||
this.ty = tx1 * matrix.b + this.ty * matrix.d + matrix.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
|
||||
* @param transform - The transform to apply the properties to.
|
||||
* @returns The transform with the newly applied properties
|
||||
*/
|
||||
decompose(transform) {
|
||||
const a = this.a;
|
||||
const b = this.b;
|
||||
const c = this.c;
|
||||
const d = this.d;
|
||||
const pivot = transform.pivot;
|
||||
const skewX = -Math.atan2(-c, d);
|
||||
const skewY = Math.atan2(b, a);
|
||||
const delta = Math.abs(skewX + skewY);
|
||||
if (delta < 1e-5 || Math.abs(PI_2 - delta) < 1e-5) {
|
||||
transform.rotation = skewY;
|
||||
transform.skew.x = transform.skew.y = 0;
|
||||
} else {
|
||||
transform.rotation = 0;
|
||||
transform.skew.x = skewX;
|
||||
transform.skew.y = skewY;
|
||||
}
|
||||
transform.scale.x = Math.sqrt(a * a + b * b);
|
||||
transform.scale.y = Math.sqrt(c * c + d * d);
|
||||
transform.position.x = this.tx + (pivot.x * a + pivot.y * c);
|
||||
transform.position.y = this.ty + (pivot.x * b + pivot.y * d);
|
||||
return transform;
|
||||
}
|
||||
/**
|
||||
* Inverts this matrix
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
invert() {
|
||||
const a1 = this.a;
|
||||
const b1 = this.b;
|
||||
const c1 = this.c;
|
||||
const d1 = this.d;
|
||||
const tx1 = this.tx;
|
||||
const n = a1 * d1 - b1 * c1;
|
||||
this.a = d1 / n;
|
||||
this.b = -b1 / n;
|
||||
this.c = -c1 / n;
|
||||
this.d = a1 / n;
|
||||
this.tx = (c1 * this.ty - d1 * tx1) / n;
|
||||
this.ty = -(a1 * this.ty - b1 * tx1) / n;
|
||||
return this;
|
||||
}
|
||||
/** Checks if this matrix is an identity matrix */
|
||||
isIdentity() {
|
||||
return this.a === 1 && this.b === 0 && this.c === 0 && this.d === 1 && this.tx === 0 && this.ty === 0;
|
||||
}
|
||||
/**
|
||||
* Resets this Matrix to an identity (default) matrix.
|
||||
* @returns This matrix. Good for chaining method calls.
|
||||
*/
|
||||
identity() {
|
||||
this.a = 1;
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
this.d = 1;
|
||||
this.tx = 0;
|
||||
this.ty = 0;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Creates a new Matrix object with the same values as this one.
|
||||
* @returns A copy of this matrix. Good for chaining method calls.
|
||||
*/
|
||||
clone() {
|
||||
const matrix = new Matrix();
|
||||
matrix.a = this.a;
|
||||
matrix.b = this.b;
|
||||
matrix.c = this.c;
|
||||
matrix.d = this.d;
|
||||
matrix.tx = this.tx;
|
||||
matrix.ty = this.ty;
|
||||
return matrix;
|
||||
}
|
||||
/**
|
||||
* Changes the values of the given matrix to be the same as the ones in this matrix
|
||||
* @param matrix - The matrix to copy to.
|
||||
* @returns The matrix given in parameter with its values updated.
|
||||
*/
|
||||
copyTo(matrix) {
|
||||
matrix.a = this.a;
|
||||
matrix.b = this.b;
|
||||
matrix.c = this.c;
|
||||
matrix.d = this.d;
|
||||
matrix.tx = this.tx;
|
||||
matrix.ty = this.ty;
|
||||
return matrix;
|
||||
}
|
||||
/**
|
||||
* Changes the values of the matrix to be the same as the ones in given matrix
|
||||
* @param matrix - The matrix to copy from.
|
||||
* @returns this
|
||||
*/
|
||||
copyFrom(matrix) {
|
||||
this.a = matrix.a;
|
||||
this.b = matrix.b;
|
||||
this.c = matrix.c;
|
||||
this.d = matrix.d;
|
||||
this.tx = matrix.tx;
|
||||
this.ty = matrix.ty;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* check to see if two matrices are the same
|
||||
* @param matrix - The matrix to compare to.
|
||||
*/
|
||||
equals(matrix) {
|
||||
return matrix.a === this.a && matrix.b === this.b && matrix.c === this.c && matrix.d === this.d && matrix.tx === this.tx && matrix.ty === this.ty;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;
|
||||
}
|
||||
/**
|
||||
* A default (identity) matrix.
|
||||
*
|
||||
* This is a shared object, if you want to modify it consider creating a new `Matrix`
|
||||
* @readonly
|
||||
*/
|
||||
static get IDENTITY() {
|
||||
return identityMatrix.identity();
|
||||
}
|
||||
/**
|
||||
* A static Matrix that can be used to avoid creating new objects.
|
||||
* Will always ensure the matrix is reset to identity when requested.
|
||||
* Use this object for fast but temporary calculations, as it may be mutated later on.
|
||||
* This is a different object to the `IDENTITY` object and so can be modified without changing `IDENTITY`.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared() {
|
||||
return tempMatrix.identity();
|
||||
}
|
||||
}
|
||||
const tempMatrix = new Matrix();
|
||||
const identityMatrix = new Matrix();
|
||||
|
||||
export { Matrix };
|
||||
//# sourceMappingURL=Matrix.mjs.map
|
1
node_modules/pixi.js/lib/maths/matrix/Matrix.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/matrix/Matrix.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
224
node_modules/pixi.js/lib/maths/matrix/groupD8.d.ts
generated
vendored
Normal file
224
node_modules/pixi.js/lib/maths/matrix/groupD8.d.ts
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
import { Matrix } from './Matrix';
|
||||
type GD8Symmetry = number;
|
||||
/**
|
||||
* @typedef {number} GD8Symmetry
|
||||
* @see groupD8
|
||||
*/
|
||||
/**
|
||||
* Implements the dihedral group D8, which is similar to
|
||||
* [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};
|
||||
* D8 is the same but with diagonals, and it is used for texture
|
||||
* rotations.
|
||||
*
|
||||
* The directions the U- and V- axes after rotation
|
||||
* of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`
|
||||
* and `(vX(a), vY(a))`. These aren't necessarily unit vectors.
|
||||
*
|
||||
* **Origin:**<br>
|
||||
* This is the small part of gameofbombs.com portal system. It works.
|
||||
* @see maths.groupD8.E
|
||||
* @see maths.groupD8.SE
|
||||
* @see maths.groupD8.S
|
||||
* @see maths.groupD8.SW
|
||||
* @see maths.groupD8.W
|
||||
* @see maths.groupD8.NW
|
||||
* @see maths.groupD8.N
|
||||
* @see maths.groupD8.NE
|
||||
* @author Ivan @ivanpopelyshev
|
||||
* @namespace maths.groupD8
|
||||
*/
|
||||
export declare const groupD8: {
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 0° | East |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
E: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 45°↻ | Southeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SE: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 90°↻ | South |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
S: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 135°↻ | Southwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SW: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 180° | West |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
W: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -135°/225°↻ | Northwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NW: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -90°/270°↻ | North |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
N: number;
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -45°/315°↻ | Northeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NE: number;
|
||||
/**
|
||||
* Reflection about Y-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_VERTICAL: number;
|
||||
/**
|
||||
* Reflection about the main diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MAIN_DIAGONAL: number;
|
||||
/**
|
||||
* Reflection about X-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_HORIZONTAL: number;
|
||||
/**
|
||||
* Reflection about reverse diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
REVERSE_DIAGONAL: number;
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uX: (ind: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uY: (ind: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vX: (ind: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vY: (ind: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - symmetry whose opposite
|
||||
* is needed. Only rotations have opposite symmetries while
|
||||
* reflections don't.
|
||||
* @returns {GD8Symmetry} The opposite symmetry of `rotation`
|
||||
*/
|
||||
inv: (rotation: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* Composes the two D8 operations.
|
||||
*
|
||||
* Taking `^` as reflection:
|
||||
*
|
||||
* | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |
|
||||
* |-------|-----|-----|-----|-----|------|-------|-------|-------|
|
||||
* | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |
|
||||
* | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |
|
||||
* | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |
|
||||
* | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |
|
||||
* | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |
|
||||
* | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |
|
||||
* | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |
|
||||
* | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |
|
||||
*
|
||||
* [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation, which
|
||||
* is the row in the above cayley table.
|
||||
* @param {GD8Symmetry} rotationFirst - First operation, which
|
||||
* is the column in the above cayley table.
|
||||
* @returns {GD8Symmetry} Composed operation
|
||||
*/
|
||||
add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* Reverse of `add`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation
|
||||
* @param {GD8Symmetry} rotationFirst - First operation
|
||||
* @returns {GD8Symmetry} Result
|
||||
*/
|
||||
sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry) => GD8Symmetry;
|
||||
/**
|
||||
* Adds 180 degrees to rotation, which is a commutative
|
||||
* operation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} rotation - The number to rotate.
|
||||
* @returns {number} Rotated number
|
||||
*/
|
||||
rotate180: (rotation: number) => number;
|
||||
/**
|
||||
* Checks if the rotation angle is vertical, i.e. south
|
||||
* or north. It doesn't work for reflections.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - The number to check.
|
||||
* @returns {boolean} Whether or not the direction is vertical
|
||||
*/
|
||||
isVertical: (rotation: GD8Symmetry) => boolean;
|
||||
/**
|
||||
* Approximates the vector `V(dx,dy)` into one of the
|
||||
* eight directions provided by `groupD8`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} dx - X-component of the vector
|
||||
* @param {number} dy - Y-component of the vector
|
||||
* @returns {GD8Symmetry} Approximation of the vector into
|
||||
* one of the eight symmetries.
|
||||
*/
|
||||
byDirection: (dx: number, dy: number) => GD8Symmetry;
|
||||
/**
|
||||
* Helps sprite to compensate texture packer rotation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {Matrix} matrix - sprite world matrix
|
||||
* @param {GD8Symmetry} rotation - The rotation factor to use.
|
||||
* @param {number} tx - sprite anchoring
|
||||
* @param {number} ty - sprite anchoring
|
||||
*/
|
||||
matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx?: number, ty?: number) => void;
|
||||
};
|
||||
export {};
|
264
node_modules/pixi.js/lib/maths/matrix/groupD8.js
generated
vendored
Normal file
264
node_modules/pixi.js/lib/maths/matrix/groupD8.js
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('./Matrix.js');
|
||||
|
||||
"use strict";
|
||||
const ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];
|
||||
const uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];
|
||||
const vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];
|
||||
const vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];
|
||||
const rotationCayley = [];
|
||||
const rotationMatrices = [];
|
||||
const signum = Math.sign;
|
||||
function init() {
|
||||
for (let i = 0; i < 16; i++) {
|
||||
const row = [];
|
||||
rotationCayley.push(row);
|
||||
for (let j = 0; j < 16; j++) {
|
||||
const _ux = signum(ux[i] * ux[j] + vx[i] * uy[j]);
|
||||
const _uy = signum(uy[i] * ux[j] + vy[i] * uy[j]);
|
||||
const _vx = signum(ux[i] * vx[j] + vx[i] * vy[j]);
|
||||
const _vy = signum(uy[i] * vx[j] + vy[i] * vy[j]);
|
||||
for (let k = 0; k < 16; k++) {
|
||||
if (ux[k] === _ux && uy[k] === _uy && vx[k] === _vx && vy[k] === _vy) {
|
||||
row.push(k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < 16; i++) {
|
||||
const mat = new Matrix.Matrix();
|
||||
mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);
|
||||
rotationMatrices.push(mat);
|
||||
}
|
||||
}
|
||||
init();
|
||||
const groupD8 = {
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 0° | East |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
E: 0,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 45°↻ | Southeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SE: 1,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 90°↻ | South |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
S: 2,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 135°↻ | Southwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SW: 3,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 180° | West |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
W: 4,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -135°/225°↻ | Northwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NW: 5,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -90°/270°↻ | North |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
N: 6,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -45°/315°↻ | Northeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NE: 7,
|
||||
/**
|
||||
* Reflection about Y-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_VERTICAL: 8,
|
||||
/**
|
||||
* Reflection about the main diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MAIN_DIAGONAL: 10,
|
||||
/**
|
||||
* Reflection about X-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_HORIZONTAL: 12,
|
||||
/**
|
||||
* Reflection about reverse diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
REVERSE_DIAGONAL: 14,
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uX: (ind) => ux[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uY: (ind) => uy[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vX: (ind) => vx[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vY: (ind) => vy[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - symmetry whose opposite
|
||||
* is needed. Only rotations have opposite symmetries while
|
||||
* reflections don't.
|
||||
* @returns {GD8Symmetry} The opposite symmetry of `rotation`
|
||||
*/
|
||||
inv: (rotation) => {
|
||||
if (rotation & 8) {
|
||||
return rotation & 15;
|
||||
}
|
||||
return -rotation & 7;
|
||||
},
|
||||
/**
|
||||
* Composes the two D8 operations.
|
||||
*
|
||||
* Taking `^` as reflection:
|
||||
*
|
||||
* | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |
|
||||
* |-------|-----|-----|-----|-----|------|-------|-------|-------|
|
||||
* | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |
|
||||
* | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |
|
||||
* | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |
|
||||
* | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |
|
||||
* | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |
|
||||
* | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |
|
||||
* | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |
|
||||
* | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |
|
||||
*
|
||||
* [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation, which
|
||||
* is the row in the above cayley table.
|
||||
* @param {GD8Symmetry} rotationFirst - First operation, which
|
||||
* is the column in the above cayley table.
|
||||
* @returns {GD8Symmetry} Composed operation
|
||||
*/
|
||||
add: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][rotationFirst],
|
||||
/**
|
||||
* Reverse of `add`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation
|
||||
* @param {GD8Symmetry} rotationFirst - First operation
|
||||
* @returns {GD8Symmetry} Result
|
||||
*/
|
||||
sub: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][groupD8.inv(rotationFirst)],
|
||||
/**
|
||||
* Adds 180 degrees to rotation, which is a commutative
|
||||
* operation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} rotation - The number to rotate.
|
||||
* @returns {number} Rotated number
|
||||
*/
|
||||
rotate180: (rotation) => rotation ^ 4,
|
||||
/**
|
||||
* Checks if the rotation angle is vertical, i.e. south
|
||||
* or north. It doesn't work for reflections.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - The number to check.
|
||||
* @returns {boolean} Whether or not the direction is vertical
|
||||
*/
|
||||
isVertical: (rotation) => (rotation & 3) === 2,
|
||||
// rotation % 4 === 2
|
||||
/**
|
||||
* Approximates the vector `V(dx,dy)` into one of the
|
||||
* eight directions provided by `groupD8`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} dx - X-component of the vector
|
||||
* @param {number} dy - Y-component of the vector
|
||||
* @returns {GD8Symmetry} Approximation of the vector into
|
||||
* one of the eight symmetries.
|
||||
*/
|
||||
byDirection: (dx, dy) => {
|
||||
if (Math.abs(dx) * 2 <= Math.abs(dy)) {
|
||||
if (dy >= 0) {
|
||||
return groupD8.S;
|
||||
}
|
||||
return groupD8.N;
|
||||
} else if (Math.abs(dy) * 2 <= Math.abs(dx)) {
|
||||
if (dx > 0) {
|
||||
return groupD8.E;
|
||||
}
|
||||
return groupD8.W;
|
||||
} else if (dy > 0) {
|
||||
if (dx > 0) {
|
||||
return groupD8.SE;
|
||||
}
|
||||
return groupD8.SW;
|
||||
} else if (dx > 0) {
|
||||
return groupD8.NE;
|
||||
}
|
||||
return groupD8.NW;
|
||||
},
|
||||
/**
|
||||
* Helps sprite to compensate texture packer rotation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {Matrix} matrix - sprite world matrix
|
||||
* @param {GD8Symmetry} rotation - The rotation factor to use.
|
||||
* @param {number} tx - sprite anchoring
|
||||
* @param {number} ty - sprite anchoring
|
||||
*/
|
||||
matrixAppendRotationInv: (matrix, rotation, tx = 0, ty = 0) => {
|
||||
const mat = rotationMatrices[groupD8.inv(rotation)];
|
||||
mat.tx = tx;
|
||||
mat.ty = ty;
|
||||
matrix.append(mat);
|
||||
}
|
||||
};
|
||||
|
||||
exports.groupD8 = groupD8;
|
||||
//# sourceMappingURL=groupD8.js.map
|
1
node_modules/pixi.js/lib/maths/matrix/groupD8.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/matrix/groupD8.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
262
node_modules/pixi.js/lib/maths/matrix/groupD8.mjs
generated
vendored
Normal file
262
node_modules/pixi.js/lib/maths/matrix/groupD8.mjs
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
import { Matrix } from './Matrix.mjs';
|
||||
|
||||
"use strict";
|
||||
const ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];
|
||||
const uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];
|
||||
const vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];
|
||||
const vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];
|
||||
const rotationCayley = [];
|
||||
const rotationMatrices = [];
|
||||
const signum = Math.sign;
|
||||
function init() {
|
||||
for (let i = 0; i < 16; i++) {
|
||||
const row = [];
|
||||
rotationCayley.push(row);
|
||||
for (let j = 0; j < 16; j++) {
|
||||
const _ux = signum(ux[i] * ux[j] + vx[i] * uy[j]);
|
||||
const _uy = signum(uy[i] * ux[j] + vy[i] * uy[j]);
|
||||
const _vx = signum(ux[i] * vx[j] + vx[i] * vy[j]);
|
||||
const _vy = signum(uy[i] * vx[j] + vy[i] * vy[j]);
|
||||
for (let k = 0; k < 16; k++) {
|
||||
if (ux[k] === _ux && uy[k] === _uy && vx[k] === _vx && vy[k] === _vy) {
|
||||
row.push(k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < 16; i++) {
|
||||
const mat = new Matrix();
|
||||
mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);
|
||||
rotationMatrices.push(mat);
|
||||
}
|
||||
}
|
||||
init();
|
||||
const groupD8 = {
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 0° | East |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
E: 0,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 45°↻ | Southeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SE: 1,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 90°↻ | South |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
S: 2,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 135°↻ | Southwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
SW: 3,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |----------|-----------|
|
||||
* | 180° | West |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
W: 4,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -135°/225°↻ | Northwest |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NW: 5,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -90°/270°↻ | North |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
N: 6,
|
||||
/**
|
||||
* | Rotation | Direction |
|
||||
* |-------------|--------------|
|
||||
* | -45°/315°↻ | Northeast |
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
NE: 7,
|
||||
/**
|
||||
* Reflection about Y-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_VERTICAL: 8,
|
||||
/**
|
||||
* Reflection about the main diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MAIN_DIAGONAL: 10,
|
||||
/**
|
||||
* Reflection about X-axis.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
MIRROR_HORIZONTAL: 12,
|
||||
/**
|
||||
* Reflection about reverse diagonal.
|
||||
* @memberof maths.groupD8
|
||||
* @constant {GD8Symmetry}
|
||||
*/
|
||||
REVERSE_DIAGONAL: 14,
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uX: (ind) => ux[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the U-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
uY: (ind) => uy[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The X-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vX: (ind) => vx[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} ind - sprite rotation angle.
|
||||
* @returns {GD8Symmetry} The Y-component of the V-axis
|
||||
* after rotating the axes.
|
||||
*/
|
||||
vY: (ind) => vy[ind],
|
||||
/**
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - symmetry whose opposite
|
||||
* is needed. Only rotations have opposite symmetries while
|
||||
* reflections don't.
|
||||
* @returns {GD8Symmetry} The opposite symmetry of `rotation`
|
||||
*/
|
||||
inv: (rotation) => {
|
||||
if (rotation & 8) {
|
||||
return rotation & 15;
|
||||
}
|
||||
return -rotation & 7;
|
||||
},
|
||||
/**
|
||||
* Composes the two D8 operations.
|
||||
*
|
||||
* Taking `^` as reflection:
|
||||
*
|
||||
* | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |
|
||||
* |-------|-----|-----|-----|-----|------|-------|-------|-------|
|
||||
* | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |
|
||||
* | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |
|
||||
* | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |
|
||||
* | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |
|
||||
* | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |
|
||||
* | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |
|
||||
* | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |
|
||||
* | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |
|
||||
*
|
||||
* [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation, which
|
||||
* is the row in the above cayley table.
|
||||
* @param {GD8Symmetry} rotationFirst - First operation, which
|
||||
* is the column in the above cayley table.
|
||||
* @returns {GD8Symmetry} Composed operation
|
||||
*/
|
||||
add: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][rotationFirst],
|
||||
/**
|
||||
* Reverse of `add`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotationSecond - Second operation
|
||||
* @param {GD8Symmetry} rotationFirst - First operation
|
||||
* @returns {GD8Symmetry} Result
|
||||
*/
|
||||
sub: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][groupD8.inv(rotationFirst)],
|
||||
/**
|
||||
* Adds 180 degrees to rotation, which is a commutative
|
||||
* operation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} rotation - The number to rotate.
|
||||
* @returns {number} Rotated number
|
||||
*/
|
||||
rotate180: (rotation) => rotation ^ 4,
|
||||
/**
|
||||
* Checks if the rotation angle is vertical, i.e. south
|
||||
* or north. It doesn't work for reflections.
|
||||
* @memberof maths.groupD8
|
||||
* @param {GD8Symmetry} rotation - The number to check.
|
||||
* @returns {boolean} Whether or not the direction is vertical
|
||||
*/
|
||||
isVertical: (rotation) => (rotation & 3) === 2,
|
||||
// rotation % 4 === 2
|
||||
/**
|
||||
* Approximates the vector `V(dx,dy)` into one of the
|
||||
* eight directions provided by `groupD8`.
|
||||
* @memberof maths.groupD8
|
||||
* @param {number} dx - X-component of the vector
|
||||
* @param {number} dy - Y-component of the vector
|
||||
* @returns {GD8Symmetry} Approximation of the vector into
|
||||
* one of the eight symmetries.
|
||||
*/
|
||||
byDirection: (dx, dy) => {
|
||||
if (Math.abs(dx) * 2 <= Math.abs(dy)) {
|
||||
if (dy >= 0) {
|
||||
return groupD8.S;
|
||||
}
|
||||
return groupD8.N;
|
||||
} else if (Math.abs(dy) * 2 <= Math.abs(dx)) {
|
||||
if (dx > 0) {
|
||||
return groupD8.E;
|
||||
}
|
||||
return groupD8.W;
|
||||
} else if (dy > 0) {
|
||||
if (dx > 0) {
|
||||
return groupD8.SE;
|
||||
}
|
||||
return groupD8.SW;
|
||||
} else if (dx > 0) {
|
||||
return groupD8.NE;
|
||||
}
|
||||
return groupD8.NW;
|
||||
},
|
||||
/**
|
||||
* Helps sprite to compensate texture packer rotation.
|
||||
* @memberof maths.groupD8
|
||||
* @param {Matrix} matrix - sprite world matrix
|
||||
* @param {GD8Symmetry} rotation - The rotation factor to use.
|
||||
* @param {number} tx - sprite anchoring
|
||||
* @param {number} ty - sprite anchoring
|
||||
*/
|
||||
matrixAppendRotationInv: (matrix, rotation, tx = 0, ty = 0) => {
|
||||
const mat = rotationMatrices[groupD8.inv(rotation)];
|
||||
mat.tx = tx;
|
||||
mat.ty = ty;
|
||||
matrix.append(mat);
|
||||
}
|
||||
};
|
||||
|
||||
export { groupD8 };
|
||||
//# sourceMappingURL=groupD8.mjs.map
|
1
node_modules/pixi.js/lib/maths/matrix/groupD8.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/matrix/groupD8.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/pixi.js/lib/maths/misc/Size.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/maths/misc/Size.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Defines a size with a width and a height.
|
||||
* @memberof maths
|
||||
*/
|
||||
export interface Size {
|
||||
/** The width. */
|
||||
width: number;
|
||||
/** The height. */
|
||||
height: number;
|
||||
}
|
4
node_modules/pixi.js/lib/maths/misc/Size.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/maths/misc/Size.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=Size.js.map
|
1
node_modules/pixi.js/lib/maths/misc/Size.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/Size.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Size.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/maths/misc/Size.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/maths/misc/Size.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=Size.mjs.map
|
1
node_modules/pixi.js/lib/maths/misc/Size.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/Size.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Size.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
41
node_modules/pixi.js/lib/maths/misc/const.d.ts
generated
vendored
Normal file
41
node_modules/pixi.js/lib/maths/misc/const.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Two Pi.
|
||||
* @static
|
||||
* @member {number}
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare const PI_2: number;
|
||||
/**
|
||||
* Conversion factor for converting radians to degrees.
|
||||
* @static
|
||||
* @member {number} RAD_TO_DEG
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare const RAD_TO_DEG: number;
|
||||
/**
|
||||
* Conversion factor for converting degrees to radians.
|
||||
* @static
|
||||
* @member {number}
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare const DEG_TO_RAD: number;
|
||||
/**
|
||||
* Constants that identify shapes, mainly to prevent `instanceof` calls.
|
||||
* @memberof maths
|
||||
*/
|
||||
export type SHAPE_PRIMITIVE = 'polygon' | 'rectangle' | 'circle' | 'ellipse' | 'triangle' | 'roundedRectangle';
|
||||
/**
|
||||
* The `maths` folder contains utility classes and functions for mathematical operations used throughout the project.
|
||||
* This includes constants such as conversion factors for radians and degrees, as well as shapes such as polygons,
|
||||
* rectangles, circles, ellipses, triangles, and rounded rectangles.
|
||||
* ```js
|
||||
* import { RAD_TO_DEG, Circle } from 'pixi.js';
|
||||
*
|
||||
* // Convert 180 degrees to radians
|
||||
* const radians = 180 * RAD_TO_DEG;
|
||||
*
|
||||
* // test if a point is inside a circle
|
||||
* const isPointInCircle = new Circle(0, 0, 10).contains(0, 0); // true
|
||||
* ```
|
||||
* @namespace maths
|
||||
*/
|
11
node_modules/pixi.js/lib/maths/misc/const.js
generated
vendored
Normal file
11
node_modules/pixi.js/lib/maths/misc/const.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const PI_2 = Math.PI * 2;
|
||||
const RAD_TO_DEG = 180 / Math.PI;
|
||||
const DEG_TO_RAD = Math.PI / 180;
|
||||
|
||||
exports.DEG_TO_RAD = DEG_TO_RAD;
|
||||
exports.PI_2 = PI_2;
|
||||
exports.RAD_TO_DEG = RAD_TO_DEG;
|
||||
//# sourceMappingURL=const.js.map
|
1
node_modules/pixi.js/lib/maths/misc/const.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/const.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"const.js","sources":["../../../src/maths/misc/const.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof maths\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof maths\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof maths\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @memberof maths\n */\nexport type SHAPE_PRIMITIVE =\n | 'polygon'\n | 'rectangle'\n | 'circle'\n | 'ellipse'\n | 'triangle'\n | 'roundedRectangle';\n\n/**\n * The `maths` folder contains utility classes and functions for mathematical operations used throughout the project.\n * This includes constants such as conversion factors for radians and degrees, as well as shapes such as polygons,\n * rectangles, circles, ellipses, triangles, and rounded rectangles.\n * ```js\n * import { RAD_TO_DEG, Circle } from 'pixi.js';\n *\n * // Convert 180 degrees to radians\n * const radians = 180 * RAD_TO_DEG;\n *\n * // test if a point is inside a circle\n * const isPointInCircle = new Circle(0, 0, 10).contains(0, 0); // true\n * ```\n * @namespace maths\n */\n"],"names":[],"mappings":";;;AAMa,MAAA,IAAA,GAAO,KAAK,EAAK,GAAA,EAAA;AAQjB,MAAA,UAAA,GAAa,MAAM,IAAK,CAAA,GAAA;AAQxB,MAAA,UAAA,GAAa,KAAK,EAAK,GAAA;;;;;;"}
|
7
node_modules/pixi.js/lib/maths/misc/const.mjs
generated
vendored
Normal file
7
node_modules/pixi.js/lib/maths/misc/const.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
const PI_2 = Math.PI * 2;
|
||||
const RAD_TO_DEG = 180 / Math.PI;
|
||||
const DEG_TO_RAD = Math.PI / 180;
|
||||
|
||||
export { DEG_TO_RAD, PI_2, RAD_TO_DEG };
|
||||
//# sourceMappingURL=const.mjs.map
|
1
node_modules/pixi.js/lib/maths/misc/const.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/const.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"const.mjs","sources":["../../../src/maths/misc/const.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof maths\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof maths\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof maths\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @memberof maths\n */\nexport type SHAPE_PRIMITIVE =\n | 'polygon'\n | 'rectangle'\n | 'circle'\n | 'ellipse'\n | 'triangle'\n | 'roundedRectangle';\n\n/**\n * The `maths` folder contains utility classes and functions for mathematical operations used throughout the project.\n * This includes constants such as conversion factors for radians and degrees, as well as shapes such as polygons,\n * rectangles, circles, ellipses, triangles, and rounded rectangles.\n * ```js\n * import { RAD_TO_DEG, Circle } from 'pixi.js';\n *\n * // Convert 180 degrees to radians\n * const radians = 180 * RAD_TO_DEG;\n *\n * // test if a point is inside a circle\n * const isPointInCircle = new Circle(0, 0, 10).contains(0, 0); // true\n * ```\n * @namespace maths\n */\n"],"names":[],"mappings":";AAMa,MAAA,IAAA,GAAO,KAAK,EAAK,GAAA,EAAA;AAQjB,MAAA,UAAA,GAAa,MAAM,IAAK,CAAA,GAAA;AAQxB,MAAA,UAAA,GAAa,KAAK,EAAK,GAAA;;;;"}
|
24
node_modules/pixi.js/lib/maths/misc/pow2.d.ts
generated
vendored
Normal file
24
node_modules/pixi.js/lib/maths/misc/pow2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Rounds to next power of two.
|
||||
* @function nextPow2
|
||||
* @param {number} v - input value
|
||||
* @returns {number} - next rounded power of two
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function nextPow2(v: number): number;
|
||||
/**
|
||||
* Checks if a number is a power of two.
|
||||
* @function isPow2
|
||||
* @param {number} v - input value
|
||||
* @returns {boolean} `true` if value is power of two
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function isPow2(v: number): boolean;
|
||||
/**
|
||||
* Computes ceil of log base 2
|
||||
* @function log2
|
||||
* @param {number} v - input value
|
||||
* @returns {number} logarithm base 2
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function log2(v: number): number;
|
35
node_modules/pixi.js/lib/maths/misc/pow2.js
generated
vendored
Normal file
35
node_modules/pixi.js/lib/maths/misc/pow2.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function nextPow2(v) {
|
||||
v += v === 0 ? 1 : 0;
|
||||
--v;
|
||||
v |= v >>> 1;
|
||||
v |= v >>> 2;
|
||||
v |= v >>> 4;
|
||||
v |= v >>> 8;
|
||||
v |= v >>> 16;
|
||||
return v + 1;
|
||||
}
|
||||
function isPow2(v) {
|
||||
return !(v & v - 1) && !!v;
|
||||
}
|
||||
function log2(v) {
|
||||
let r = (v > 65535 ? 1 : 0) << 4;
|
||||
v >>>= r;
|
||||
let shift = (v > 255 ? 1 : 0) << 3;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
shift = (v > 15 ? 1 : 0) << 2;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
shift = (v > 3 ? 1 : 0) << 1;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
return r | v >> 1;
|
||||
}
|
||||
|
||||
exports.isPow2 = isPow2;
|
||||
exports.log2 = log2;
|
||||
exports.nextPow2 = nextPow2;
|
||||
//# sourceMappingURL=pow2.js.map
|
1
node_modules/pixi.js/lib/maths/misc/pow2.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/pow2.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pow2.js","sources":["../../../src/maths/misc/pow2.ts"],"sourcesContent":["// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n * @memberof maths\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n * @memberof maths\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n * @memberof maths\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n"],"names":[],"mappings":";;;AASO,SAAS,SAAS,CACzB,EAAA;AACI,EAAK,CAAA,IAAA,CAAA,KAAM,IAAI,CAAI,GAAA,CAAA,CAAA;AACnB,EAAE,EAAA,CAAA,CAAA;AACF,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,EAAA,CAAA;AAEX,EAAA,OAAO,CAAI,GAAA,CAAA,CAAA;AACf,CAAA;AASO,SAAS,OAAO,CACvB,EAAA;AACI,EAAA,OAAO,EAAE,CAAA,GAAK,CAAI,GAAA,CAAA,CAAA,IAAQ,CAAC,CAAC,CAAA,CAAA;AAChC,CAAA;AASO,SAAS,KAAK,CACrB,EAAA;AACI,EAAA,IAAI,CAAK,GAAA,CAAA,CAAA,GAAI,KAAS,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAEhC,EAAO,CAAA,MAAA,CAAA,CAAA;AAEP,EAAA,IAAI,KAAS,GAAA,CAAA,CAAA,GAAI,GAAO,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAElC,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AACnB,EAAS,KAAA,GAAA,CAAA,CAAA,GAAI,EAAM,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAC7B,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AACnB,EAAS,KAAA,GAAA,CAAA,CAAA,GAAI,CAAM,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAC7B,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AAEnB,EAAA,OAAO,IAAK,CAAK,IAAA,CAAA,CAAA;AACrB;;;;;;"}
|
31
node_modules/pixi.js/lib/maths/misc/pow2.mjs
generated
vendored
Normal file
31
node_modules/pixi.js/lib/maths/misc/pow2.mjs
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
function nextPow2(v) {
|
||||
v += v === 0 ? 1 : 0;
|
||||
--v;
|
||||
v |= v >>> 1;
|
||||
v |= v >>> 2;
|
||||
v |= v >>> 4;
|
||||
v |= v >>> 8;
|
||||
v |= v >>> 16;
|
||||
return v + 1;
|
||||
}
|
||||
function isPow2(v) {
|
||||
return !(v & v - 1) && !!v;
|
||||
}
|
||||
function log2(v) {
|
||||
let r = (v > 65535 ? 1 : 0) << 4;
|
||||
v >>>= r;
|
||||
let shift = (v > 255 ? 1 : 0) << 3;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
shift = (v > 15 ? 1 : 0) << 2;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
shift = (v > 3 ? 1 : 0) << 1;
|
||||
v >>>= shift;
|
||||
r |= shift;
|
||||
return r | v >> 1;
|
||||
}
|
||||
|
||||
export { isPow2, log2, nextPow2 };
|
||||
//# sourceMappingURL=pow2.mjs.map
|
1
node_modules/pixi.js/lib/maths/misc/pow2.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/pow2.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pow2.mjs","sources":["../../../src/maths/misc/pow2.ts"],"sourcesContent":["// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n * @memberof maths\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n * @memberof maths\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n * @memberof maths\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n"],"names":[],"mappings":";AASO,SAAS,SAAS,CACzB,EAAA;AACI,EAAK,CAAA,IAAA,CAAA,KAAM,IAAI,CAAI,GAAA,CAAA,CAAA;AACnB,EAAE,EAAA,CAAA,CAAA;AACF,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,CAAA,CAAA;AACX,EAAA,CAAA,IAAK,CAAM,KAAA,EAAA,CAAA;AAEX,EAAA,OAAO,CAAI,GAAA,CAAA,CAAA;AACf,CAAA;AASO,SAAS,OAAO,CACvB,EAAA;AACI,EAAA,OAAO,EAAE,CAAA,GAAK,CAAI,GAAA,CAAA,CAAA,IAAQ,CAAC,CAAC,CAAA,CAAA;AAChC,CAAA;AASO,SAAS,KAAK,CACrB,EAAA;AACI,EAAA,IAAI,CAAK,GAAA,CAAA,CAAA,GAAI,KAAS,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAEhC,EAAO,CAAA,MAAA,CAAA,CAAA;AAEP,EAAA,IAAI,KAAS,GAAA,CAAA,CAAA,GAAI,GAAO,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAElC,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AACnB,EAAS,KAAA,GAAA,CAAA,CAAA,GAAI,EAAM,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAC7B,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AACnB,EAAS,KAAA,GAAA,CAAA,CAAA,GAAI,CAAM,GAAA,CAAA,GAAI,CAAM,KAAA,CAAA,CAAA;AAC7B,EAAO,CAAA,MAAA,KAAA,CAAA;AAAO,EAAK,CAAA,IAAA,KAAA,CAAA;AAEnB,EAAA,OAAO,IAAK,CAAK,IAAA,CAAA,CAAA;AACrB;;;;"}
|
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function squaredDistanceToLineSegment(x: number, y: number, x1: number, y1: number, x2: number, y2: number): number;
|
33
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.js
generated
vendored
Normal file
33
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function squaredDistanceToLineSegment(x, y, x1, y1, x2, y2) {
|
||||
const a = x - x1;
|
||||
const b = y - y1;
|
||||
const c = x2 - x1;
|
||||
const d = y2 - y1;
|
||||
const dot = a * c + b * d;
|
||||
const lenSq = c * c + d * d;
|
||||
let param = -1;
|
||||
if (lenSq !== 0) {
|
||||
param = dot / lenSq;
|
||||
}
|
||||
let xx;
|
||||
let yy;
|
||||
if (param < 0) {
|
||||
xx = x1;
|
||||
yy = y1;
|
||||
} else if (param > 1) {
|
||||
xx = x2;
|
||||
yy = y2;
|
||||
} else {
|
||||
xx = x1 + param * c;
|
||||
yy = y1 + param * d;
|
||||
}
|
||||
const dx = x - xx;
|
||||
const dy = y - yy;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
exports.squaredDistanceToLineSegment = squaredDistanceToLineSegment;
|
||||
//# sourceMappingURL=squaredDistanceToLineSegment.js.map
|
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"squaredDistanceToLineSegment.js","sources":["../../../src/maths/misc/squaredDistanceToLineSegment.ts"],"sourcesContent":["export function squaredDistanceToLineSegment(\n x: number, y: number,\n x1: number, y1: number,\n x2: number, y2: number\n): number\n{\n const a = x - x1;\n const b = y - y1;\n const c = x2 - x1;\n const d = y2 - y1;\n\n const dot = (a * c) + (b * d);\n const lenSq = (c * c) + (d * d);\n let param = -1;\n\n if (lenSq !== 0)\n {\n param = dot / lenSq;\n }\n\n let xx; let\n yy;\n\n if (param < 0)\n {\n xx = x1;\n yy = y1;\n }\n else if (param > 1)\n {\n xx = x2;\n yy = y2;\n }\n\n else\n {\n xx = x1 + (param * c);\n yy = y1 + (param * d);\n }\n\n const dx = x - xx;\n const dy = y - yy;\n\n return (dx * dx) + (dy * dy);\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,6BACZ,CAAW,EAAA,CAAA,EACX,EAAY,EAAA,EAAA,EACZ,IAAY,EAEhB,EAAA;AACI,EAAA,MAAM,IAAI,CAAI,GAAA,EAAA,CAAA;AACd,EAAA,MAAM,IAAI,CAAI,GAAA,EAAA,CAAA;AACd,EAAA,MAAM,IAAI,EAAK,GAAA,EAAA,CAAA;AACf,EAAA,MAAM,IAAI,EAAK,GAAA,EAAA,CAAA;AAEf,EAAM,MAAA,GAAA,GAAO,CAAI,GAAA,CAAA,GAAM,CAAI,GAAA,CAAA,CAAA;AAC3B,EAAM,MAAA,KAAA,GAAS,CAAI,GAAA,CAAA,GAAM,CAAI,GAAA,CAAA,CAAA;AAC7B,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA,CAAA;AAEZ,EAAA,IAAI,UAAU,CACd,EAAA;AACI,IAAA,KAAA,GAAQ,GAAM,GAAA,KAAA,CAAA;AAAA,GAClB;AAEA,EAAI,IAAA,EAAA,CAAA;AAAI,EACJ,IAAA,EAAA,CAAA;AAEJ,EAAA,IAAI,QAAQ,CACZ,EAAA;AACI,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GACT,MAAA,IACS,QAAQ,CACjB,EAAA;AACI,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GAIT,MAAA;AACI,IAAA,EAAA,GAAK,KAAM,KAAQ,GAAA,CAAA,CAAA;AACnB,IAAA,EAAA,GAAK,KAAM,KAAQ,GAAA,CAAA,CAAA;AAAA,GACvB;AAEA,EAAA,MAAM,KAAK,CAAI,GAAA,EAAA,CAAA;AACf,EAAA,MAAM,KAAK,CAAI,GAAA,EAAA,CAAA;AAEf,EAAQ,OAAA,EAAA,GAAK,KAAO,EAAK,GAAA,EAAA,CAAA;AAC7B;;;;"}
|
31
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs
generated
vendored
Normal file
31
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
function squaredDistanceToLineSegment(x, y, x1, y1, x2, y2) {
|
||||
const a = x - x1;
|
||||
const b = y - y1;
|
||||
const c = x2 - x1;
|
||||
const d = y2 - y1;
|
||||
const dot = a * c + b * d;
|
||||
const lenSq = c * c + d * d;
|
||||
let param = -1;
|
||||
if (lenSq !== 0) {
|
||||
param = dot / lenSq;
|
||||
}
|
||||
let xx;
|
||||
let yy;
|
||||
if (param < 0) {
|
||||
xx = x1;
|
||||
yy = y1;
|
||||
} else if (param > 1) {
|
||||
xx = x2;
|
||||
yy = y2;
|
||||
} else {
|
||||
xx = x1 + param * c;
|
||||
yy = y1 + param * d;
|
||||
}
|
||||
const dx = x - xx;
|
||||
const dy = y - yy;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
export { squaredDistanceToLineSegment };
|
||||
//# sourceMappingURL=squaredDistanceToLineSegment.mjs.map
|
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"squaredDistanceToLineSegment.mjs","sources":["../../../src/maths/misc/squaredDistanceToLineSegment.ts"],"sourcesContent":["export function squaredDistanceToLineSegment(\n x: number, y: number,\n x1: number, y1: number,\n x2: number, y2: number\n): number\n{\n const a = x - x1;\n const b = y - y1;\n const c = x2 - x1;\n const d = y2 - y1;\n\n const dot = (a * c) + (b * d);\n const lenSq = (c * c) + (d * d);\n let param = -1;\n\n if (lenSq !== 0)\n {\n param = dot / lenSq;\n }\n\n let xx; let\n yy;\n\n if (param < 0)\n {\n xx = x1;\n yy = y1;\n }\n else if (param > 1)\n {\n xx = x2;\n yy = y2;\n }\n\n else\n {\n xx = x1 + (param * c);\n yy = y1 + (param * d);\n }\n\n const dx = x - xx;\n const dy = y - yy;\n\n return (dx * dx) + (dy * dy);\n}\n"],"names":[],"mappings":";AAAO,SAAS,6BACZ,CAAW,EAAA,CAAA,EACX,EAAY,EAAA,EAAA,EACZ,IAAY,EAEhB,EAAA;AACI,EAAA,MAAM,IAAI,CAAI,GAAA,EAAA,CAAA;AACd,EAAA,MAAM,IAAI,CAAI,GAAA,EAAA,CAAA;AACd,EAAA,MAAM,IAAI,EAAK,GAAA,EAAA,CAAA;AACf,EAAA,MAAM,IAAI,EAAK,GAAA,EAAA,CAAA;AAEf,EAAM,MAAA,GAAA,GAAO,CAAI,GAAA,CAAA,GAAM,CAAI,GAAA,CAAA,CAAA;AAC3B,EAAM,MAAA,KAAA,GAAS,CAAI,GAAA,CAAA,GAAM,CAAI,GAAA,CAAA,CAAA;AAC7B,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA,CAAA;AAEZ,EAAA,IAAI,UAAU,CACd,EAAA;AACI,IAAA,KAAA,GAAQ,GAAM,GAAA,KAAA,CAAA;AAAA,GAClB;AAEA,EAAI,IAAA,EAAA,CAAA;AAAI,EACJ,IAAA,EAAA,CAAA;AAEJ,EAAA,IAAI,QAAQ,CACZ,EAAA;AACI,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GACT,MAAA,IACS,QAAQ,CACjB,EAAA;AACI,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GAIT,MAAA;AACI,IAAA,EAAA,GAAK,KAAM,KAAQ,GAAA,CAAA,CAAA;AACnB,IAAA,EAAA,GAAK,KAAM,KAAQ,GAAA,CAAA,CAAA;AAAA,GACvB;AAEA,EAAA,MAAM,KAAK,CAAI,GAAA,EAAA,CAAA;AACf,EAAA,MAAM,KAAK,CAAI,GAAA,EAAA,CAAA;AAEf,EAAQ,OAAA,EAAA,GAAK,KAAO,EAAK,GAAA,EAAA,CAAA;AAC7B;;;;"}
|
73
node_modules/pixi.js/lib/maths/point/ObservablePoint.d.ts
generated
vendored
Normal file
73
node_modules/pixi.js/lib/maths/point/ObservablePoint.d.ts
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
import type { PointData } from './PointData';
|
||||
import type { PointLike } from './PointLike';
|
||||
export interface ObservablePoint extends PixiMixins.ObservablePoint {
|
||||
}
|
||||
/**
|
||||
* Observer used to listen for observable point changes.
|
||||
* @memberof maths
|
||||
*/
|
||||
export interface Observer<T> {
|
||||
/** Callback to call when the point has updated. */
|
||||
_onUpdate: (point?: T) => void;
|
||||
}
|
||||
/**
|
||||
* The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents
|
||||
* the position on the horizontal axis and `y` represents the position on the vertical axis.
|
||||
*
|
||||
* An `ObservablePoint` is a point that triggers the `onUpdate` method on an observer when the point's position is changed.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class ObservablePoint implements PointLike {
|
||||
/** @ignore */
|
||||
_x: number;
|
||||
/** @ignore */
|
||||
_y: number;
|
||||
/** This object used to call the `onUpdate` callback when the point changes. */
|
||||
private readonly _observer;
|
||||
/**
|
||||
* Creates a new `ObservablePoint`
|
||||
* @param observer - Observer to pass to listen for change events.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(observer: Observer<ObservablePoint>, x?: number, y?: number);
|
||||
/**
|
||||
* Creates a clone of this point.
|
||||
* @param observer - Optional observer to pass to the new observable point.
|
||||
* @returns a copy of this observable point
|
||||
*/
|
||||
clone(observer?: Observer<ObservablePoint>): ObservablePoint;
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=x] - position of the point on the y axis
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
set(x?: number, y?: number): this;
|
||||
/**
|
||||
* Copies x and y from the given point (`p`)
|
||||
* @param p - The point to copy from. Can be any of type that is or extends `PointData`
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
copyFrom(p: PointData): this;
|
||||
/**
|
||||
* Copies this point's x and y into that of the given point (`p`)
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo<T extends PointLike>(p: T): T;
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p: PointData): boolean;
|
||||
toString(): string;
|
||||
/** Position of the observable point on the x axis. */
|
||||
get x(): number;
|
||||
set x(value: number);
|
||||
/** Position of the observable point on the y axis. */
|
||||
get y(): number;
|
||||
set y(value: number);
|
||||
}
|
95
node_modules/pixi.js/lib/maths/point/ObservablePoint.js
generated
vendored
Normal file
95
node_modules/pixi.js/lib/maths/point/ObservablePoint.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
class ObservablePoint {
|
||||
/**
|
||||
* Creates a new `ObservablePoint`
|
||||
* @param observer - Observer to pass to listen for change events.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(observer, x, y) {
|
||||
this._x = x || 0;
|
||||
this._y = y || 0;
|
||||
this._observer = observer;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this point.
|
||||
* @param observer - Optional observer to pass to the new observable point.
|
||||
* @returns a copy of this observable point
|
||||
*/
|
||||
clone(observer) {
|
||||
return new ObservablePoint(observer ?? this._observer, this._x, this._y);
|
||||
}
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=x] - position of the point on the y axis
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
set(x = 0, y = x) {
|
||||
if (this._x !== x || this._y !== y) {
|
||||
this._x = x;
|
||||
this._y = y;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies x and y from the given point (`p`)
|
||||
* @param p - The point to copy from. Can be any of type that is or extends `PointData`
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
copyFrom(p) {
|
||||
if (this._x !== p.x || this._y !== p.y) {
|
||||
this._x = p.x;
|
||||
this._y = p.y;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this point's x and y into that of the given point (`p`)
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo(p) {
|
||||
p.set(this._x, this._y);
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p) {
|
||||
return p.x === this._x && p.y === this._y;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:ObservablePoint x=${0} y=${0} scope=${this._observer}]`;
|
||||
}
|
||||
/** Position of the observable point on the x axis. */
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
set x(value) {
|
||||
if (this._x !== value) {
|
||||
this._x = value;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
}
|
||||
/** Position of the observable point on the y axis. */
|
||||
get y() {
|
||||
return this._y;
|
||||
}
|
||||
set y(value) {
|
||||
if (this._y !== value) {
|
||||
this._y = value;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.ObservablePoint = ObservablePoint;
|
||||
//# sourceMappingURL=ObservablePoint.js.map
|
1
node_modules/pixi.js/lib/maths/point/ObservablePoint.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/ObservablePoint.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
93
node_modules/pixi.js/lib/maths/point/ObservablePoint.mjs
generated
vendored
Normal file
93
node_modules/pixi.js/lib/maths/point/ObservablePoint.mjs
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
class ObservablePoint {
|
||||
/**
|
||||
* Creates a new `ObservablePoint`
|
||||
* @param observer - Observer to pass to listen for change events.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(observer, x, y) {
|
||||
this._x = x || 0;
|
||||
this._y = y || 0;
|
||||
this._observer = observer;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this point.
|
||||
* @param observer - Optional observer to pass to the new observable point.
|
||||
* @returns a copy of this observable point
|
||||
*/
|
||||
clone(observer) {
|
||||
return new ObservablePoint(observer ?? this._observer, this._x, this._y);
|
||||
}
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=x] - position of the point on the y axis
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
set(x = 0, y = x) {
|
||||
if (this._x !== x || this._y !== y) {
|
||||
this._x = x;
|
||||
this._y = y;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies x and y from the given point (`p`)
|
||||
* @param p - The point to copy from. Can be any of type that is or extends `PointData`
|
||||
* @returns The observable point instance itself
|
||||
*/
|
||||
copyFrom(p) {
|
||||
if (this._x !== p.x || this._y !== p.y) {
|
||||
this._x = p.x;
|
||||
this._y = p.y;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this point's x and y into that of the given point (`p`)
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo(p) {
|
||||
p.set(this._x, this._y);
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p) {
|
||||
return p.x === this._x && p.y === this._y;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:ObservablePoint x=${0} y=${0} scope=${this._observer}]`;
|
||||
}
|
||||
/** Position of the observable point on the x axis. */
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
set x(value) {
|
||||
if (this._x !== value) {
|
||||
this._x = value;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
}
|
||||
/** Position of the observable point on the y axis. */
|
||||
get y() {
|
||||
return this._y;
|
||||
}
|
||||
set y(value) {
|
||||
if (this._y !== value) {
|
||||
this._y = value;
|
||||
this._observer._onUpdate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { ObservablePoint };
|
||||
//# sourceMappingURL=ObservablePoint.mjs.map
|
1
node_modules/pixi.js/lib/maths/point/ObservablePoint.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/ObservablePoint.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
node_modules/pixi.js/lib/maths/point/Point.d.ts
generated
vendored
Normal file
63
node_modules/pixi.js/lib/maths/point/Point.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { PointData } from './PointData';
|
||||
import type { PointLike } from './PointLike';
|
||||
export interface Point extends PixiMixins.Point {
|
||||
}
|
||||
/**
|
||||
* The Point object represents a location in a two-dimensional coordinate system, where `x` represents
|
||||
* the position on the horizontal axis and `y` represents the position on the vertical axis.
|
||||
* <br/>
|
||||
* Many Pixi functions accept the `PointData` type as an alternative to `Point`,
|
||||
* which only requires `x` and `y` properties.
|
||||
* @class
|
||||
* @implements {PointLike}
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Point implements PointLike {
|
||||
/** Position of the point on the x axis */
|
||||
x: number;
|
||||
/** Position of the point on the y axis */
|
||||
y: number;
|
||||
/**
|
||||
* Creates a new `Point`
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(x?: number, y?: number);
|
||||
/**
|
||||
* Creates a clone of this point
|
||||
* @returns A clone of this point
|
||||
*/
|
||||
clone(): Point;
|
||||
/**
|
||||
* Copies `x` and `y` from the given point into this point
|
||||
* @param p - The point to copy from
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
copyFrom(p: PointData): this;
|
||||
/**
|
||||
* Copies this point's x and y into the given point (`p`).
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo<T extends PointLike>(p: T): T;
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p: PointData): boolean;
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the `x` axis
|
||||
* @param {number} [y=x] - position of the point on the `y` axis
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
set(x?: number, y?: number): this;
|
||||
toString(): string;
|
||||
/**
|
||||
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared(): Point;
|
||||
}
|
79
node_modules/pixi.js/lib/maths/point/Point.js
generated
vendored
Normal file
79
node_modules/pixi.js/lib/maths/point/Point.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
class Point {
|
||||
/**
|
||||
* Creates a new `Point`
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(x = 0, y = 0) {
|
||||
/** Position of the point on the x axis */
|
||||
this.x = 0;
|
||||
/** Position of the point on the y axis */
|
||||
this.y = 0;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this point
|
||||
* @returns A clone of this point
|
||||
*/
|
||||
clone() {
|
||||
return new Point(this.x, this.y);
|
||||
}
|
||||
/**
|
||||
* Copies `x` and `y` from the given point into this point
|
||||
* @param p - The point to copy from
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
copyFrom(p) {
|
||||
this.set(p.x, p.y);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this point's x and y into the given point (`p`).
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo(p) {
|
||||
p.set(this.x, this.y);
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p) {
|
||||
return p.x === this.x && p.y === this.y;
|
||||
}
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the `x` axis
|
||||
* @param {number} [y=x] - position of the point on the `y` axis
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
set(x = 0, y = x) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Point x=${this.x} y=${this.y}]`;
|
||||
}
|
||||
/**
|
||||
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared() {
|
||||
tempPoint.x = 0;
|
||||
tempPoint.y = 0;
|
||||
return tempPoint;
|
||||
}
|
||||
}
|
||||
const tempPoint = new Point();
|
||||
|
||||
exports.Point = Point;
|
||||
//# sourceMappingURL=Point.js.map
|
1
node_modules/pixi.js/lib/maths/point/Point.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/Point.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Point.js","sources":["../../../src/maths/point/Point.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport type { PointData } from './PointData';\nimport type { PointLike } from './PointLike';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Point extends PixiMixins.Point { }\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n * <br/>\n * Many Pixi functions accept the `PointData` type as an alternative to `Point`,\n * which only requires `x` and `y` properties.\n * @class\n * @implements {PointLike}\n * @memberof maths\n */\nexport class Point implements PointLike\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n public clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n public copyFrom(p: PointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `PointData`\n * @returns The point (`p`) with values updated\n */\n public copyTo<T extends PointLike>(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n public equals(p: PointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n public set(x = 0, y: number = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n public toString(): string\n {\n return `[pixi.js/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n\n /**\n * A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.\n * @readonly\n */\n static get shared(): Point\n {\n tempPoint.x = 0;\n tempPoint.y = 0;\n\n return tempPoint;\n }\n}\n\nconst tempPoint = new Point();\n"],"names":[],"mappings":";;;AAiBO,MAAM,KACb,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWI,WAAY,CAAA,CAAA,GAAI,CAAG,EAAA,CAAA,GAAI,CACvB,EAAA;AAVA;AAAA,IAAA,IAAA,CAAO,CAAI,GAAA,CAAA,CAAA;AAEX;AAAA,IAAA,IAAA,CAAO,CAAI,GAAA,CAAA,CAAA;AASP,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AAAA,GACb;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,KACP,GAAA;AACI,IAAA,OAAO,IAAI,KAAA,CAAM,IAAK,CAAA,CAAA,EAAG,KAAK,CAAC,CAAA,CAAA;AAAA,GACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,SAAS,CAChB,EAAA;AACI,IAAA,IAAA,CAAK,GAAI,CAAA,CAAA,CAAE,CAAG,EAAA,CAAA,CAAE,CAAC,CAAA,CAAA;AAEjB,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAA4B,CACnC,EAAA;AACI,IAAA,CAAA,CAAE,GAAI,CAAA,IAAA,CAAK,CAAG,EAAA,IAAA,CAAK,CAAC,CAAA,CAAA;AAEpB,IAAO,OAAA,CAAA,CAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAAO,CACd,EAAA;AACI,IAAA,OAAQ,EAAE,CAAM,KAAA,IAAA,CAAK,CAAO,IAAA,CAAA,CAAE,MAAM,IAAK,CAAA,CAAA,CAAA;AAAA,GAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,GAAI,CAAA,CAAA,GAAI,CAAG,EAAA,CAAA,GAAY,CAC9B,EAAA;AACI,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AAET,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAAA,EAGO,QACP,GAAA;AACI,IAAA,OAAO,CAAyB,sBAAA,EAAA,IAAA,CAAK,CAAC,CAAA,GAAA,EAAM,KAAK,CAAC,CAAA,CAAA,CAAA,CAAA;AAAA,GACtD;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,MACX,GAAA;AACI,IAAA,SAAA,CAAU,CAAI,GAAA,CAAA,CAAA;AACd,IAAA,SAAA,CAAU,CAAI,GAAA,CAAA,CAAA;AAEd,IAAO,OAAA,SAAA,CAAA;AAAA,GACX;AACJ,CAAA;AAEA,MAAM,SAAA,GAAY,IAAI,KAAM,EAAA;;;;"}
|
77
node_modules/pixi.js/lib/maths/point/Point.mjs
generated
vendored
Normal file
77
node_modules/pixi.js/lib/maths/point/Point.mjs
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
class Point {
|
||||
/**
|
||||
* Creates a new `Point`
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=0] - position of the point on the y axis
|
||||
*/
|
||||
constructor(x = 0, y = 0) {
|
||||
/** Position of the point on the x axis */
|
||||
this.x = 0;
|
||||
/** Position of the point on the y axis */
|
||||
this.y = 0;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this point
|
||||
* @returns A clone of this point
|
||||
*/
|
||||
clone() {
|
||||
return new Point(this.x, this.y);
|
||||
}
|
||||
/**
|
||||
* Copies `x` and `y` from the given point into this point
|
||||
* @param p - The point to copy from
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
copyFrom(p) {
|
||||
this.set(p.x, p.y);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this point's x and y into the given point (`p`).
|
||||
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
||||
* @returns The point (`p`) with values updated
|
||||
*/
|
||||
copyTo(p) {
|
||||
p.set(this.x, this.y);
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
||||
* @param p - The point to check
|
||||
* @returns Returns `true` if both `x` and `y` are equal
|
||||
*/
|
||||
equals(p) {
|
||||
return p.x === this.x && p.y === this.y;
|
||||
}
|
||||
/**
|
||||
* Sets the point to a new `x` and `y` position.
|
||||
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
||||
* @param {number} [x=0] - position of the point on the `x` axis
|
||||
* @param {number} [y=x] - position of the point on the `y` axis
|
||||
* @returns The point instance itself
|
||||
*/
|
||||
set(x = 0, y = x) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Point x=${this.x} y=${this.y}]`;
|
||||
}
|
||||
/**
|
||||
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
||||
* @readonly
|
||||
*/
|
||||
static get shared() {
|
||||
tempPoint.x = 0;
|
||||
tempPoint.y = 0;
|
||||
return tempPoint;
|
||||
}
|
||||
}
|
||||
const tempPoint = new Point();
|
||||
|
||||
export { Point };
|
||||
//# sourceMappingURL=Point.mjs.map
|
1
node_modules/pixi.js/lib/maths/point/Point.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/Point.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Point.mjs","sources":["../../../src/maths/point/Point.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport type { PointData } from './PointData';\nimport type { PointLike } from './PointLike';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Point extends PixiMixins.Point { }\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n * <br/>\n * Many Pixi functions accept the `PointData` type as an alternative to `Point`,\n * which only requires `x` and `y` properties.\n * @class\n * @implements {PointLike}\n * @memberof maths\n */\nexport class Point implements PointLike\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n public clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n public copyFrom(p: PointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `PointData`\n * @returns The point (`p`) with values updated\n */\n public copyTo<T extends PointLike>(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n public equals(p: PointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n public set(x = 0, y: number = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n public toString(): string\n {\n return `[pixi.js/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n\n /**\n * A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.\n * @readonly\n */\n static get shared(): Point\n {\n tempPoint.x = 0;\n tempPoint.y = 0;\n\n return tempPoint;\n }\n}\n\nconst tempPoint = new Point();\n"],"names":[],"mappings":";AAiBO,MAAM,KACb,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWI,WAAY,CAAA,CAAA,GAAI,CAAG,EAAA,CAAA,GAAI,CACvB,EAAA;AAVA;AAAA,IAAA,IAAA,CAAO,CAAI,GAAA,CAAA,CAAA;AAEX;AAAA,IAAA,IAAA,CAAO,CAAI,GAAA,CAAA,CAAA;AASP,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AAAA,GACb;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,KACP,GAAA;AACI,IAAA,OAAO,IAAI,KAAA,CAAM,IAAK,CAAA,CAAA,EAAG,KAAK,CAAC,CAAA,CAAA;AAAA,GACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,SAAS,CAChB,EAAA;AACI,IAAA,IAAA,CAAK,GAAI,CAAA,CAAA,CAAE,CAAG,EAAA,CAAA,CAAE,CAAC,CAAA,CAAA;AAEjB,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAA4B,CACnC,EAAA;AACI,IAAA,CAAA,CAAE,GAAI,CAAA,IAAA,CAAK,CAAG,EAAA,IAAA,CAAK,CAAC,CAAA,CAAA;AAEpB,IAAO,OAAA,CAAA,CAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAAO,CACd,EAAA;AACI,IAAA,OAAQ,EAAE,CAAM,KAAA,IAAA,CAAK,CAAO,IAAA,CAAA,CAAE,MAAM,IAAK,CAAA,CAAA,CAAA;AAAA,GAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,GAAI,CAAA,CAAA,GAAI,CAAG,EAAA,CAAA,GAAY,CAC9B,EAAA;AACI,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA,CAAA;AAET,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAAA,EAGO,QACP,GAAA;AACI,IAAA,OAAO,CAAyB,sBAAA,EAAA,IAAA,CAAK,CAAC,CAAA,GAAA,EAAM,KAAK,CAAC,CAAA,CAAA,CAAA,CAAA;AAAA,GACtD;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,MACX,GAAA;AACI,IAAA,SAAA,CAAU,CAAI,GAAA,CAAA,CAAA;AACd,IAAA,SAAA,CAAU,CAAI,GAAA,CAAA,CAAA;AAEd,IAAO,OAAA,SAAA,CAAA;AAAA,GACX;AACJ,CAAA;AAEA,MAAM,SAAA,GAAY,IAAI,KAAM,EAAA;;;;"}
|
10
node_modules/pixi.js/lib/maths/point/PointData.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/maths/point/PointData.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Common interface for points. Both Point and ObservablePoint implement it
|
||||
* @memberof maths
|
||||
*/
|
||||
export interface PointData {
|
||||
/** X coord */
|
||||
x: number;
|
||||
/** Y coord */
|
||||
y: number;
|
||||
}
|
4
node_modules/pixi.js/lib/maths/point/PointData.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/maths/point/PointData.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=PointData.js.map
|
1
node_modules/pixi.js/lib/maths/point/PointData.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/PointData.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PointData.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/maths/point/PointData.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/maths/point/PointData.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=PointData.mjs.map
|
1
node_modules/pixi.js/lib/maths/point/PointData.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/PointData.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PointData.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
32
node_modules/pixi.js/lib/maths/point/PointLike.d.ts
generated
vendored
Normal file
32
node_modules/pixi.js/lib/maths/point/PointLike.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { PointData } from './PointData';
|
||||
/**
|
||||
* Common interface for points. Both Point and ObservablePoint implement it
|
||||
* @memberof maths
|
||||
*/
|
||||
export interface PointLike extends PointData {
|
||||
/**
|
||||
* Copies x and y from the given point
|
||||
* @param {PointData} p - The point to copy from
|
||||
* @returns {this} Returns itself.
|
||||
*/
|
||||
copyFrom: (p: PointData) => this;
|
||||
/**
|
||||
* Copies x and y into the given point
|
||||
* @param {PointLike} p - The point to copy.
|
||||
* @returns {PointLike} Given point with values updated
|
||||
*/
|
||||
copyTo: <T extends PointLike>(p: T) => T;
|
||||
/**
|
||||
* Returns true if the given point is equal to this point
|
||||
* @param {PointData} p - The point to check
|
||||
* @returns {boolean} Whether the given point equal to this point
|
||||
*/
|
||||
equals: (p: PointData) => boolean;
|
||||
/**
|
||||
* Sets the point to a new x and y position.
|
||||
* If y is omitted, both x and y will be set to x.
|
||||
* @param {number} [x=0] - position of the point on the x axis
|
||||
* @param {number} [y=x] - position of the point on the y axis
|
||||
*/
|
||||
set: (x?: number, y?: number) => void;
|
||||
}
|
4
node_modules/pixi.js/lib/maths/point/PointLike.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/maths/point/PointLike.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=PointLike.js.map
|
1
node_modules/pixi.js/lib/maths/point/PointLike.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/PointLike.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PointLike.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/maths/point/PointLike.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/maths/point/PointLike.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=PointLike.mjs.map
|
1
node_modules/pixi.js/lib/maths/point/PointLike.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/PointLike.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PointLike.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
13
node_modules/pixi.js/lib/maths/point/pointInTriangle.d.ts
generated
vendored
Normal file
13
node_modules/pixi.js/lib/maths/point/pointInTriangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Check if a point is inside a triangle.
|
||||
* @param px - x coordinate of the point
|
||||
* @param py - y coordinate of the point
|
||||
* @param x1 - x coordinate of the first vertex of the triangle
|
||||
* @param y1 - y coordinate of the first vertex of the triangle
|
||||
* @param x2 - x coordinate of the second vertex of the triangle
|
||||
* @param y2 - y coordinate of the second vertex of the triangle
|
||||
* @param x3 - x coordinate of the third vertex of the triangle
|
||||
* @param y3 - y coordinate of the third vertex of the triangle
|
||||
* @returns `true` if the point is inside the triangle, `false` otherwise
|
||||
*/
|
||||
export declare function pointInTriangle(px: number, py: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): boolean;
|
23
node_modules/pixi.js/lib/maths/point/pointInTriangle.js
generated
vendored
Normal file
23
node_modules/pixi.js/lib/maths/point/pointInTriangle.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function pointInTriangle(px, py, x1, y1, x2, y2, x3, y3) {
|
||||
const v2x = x3 - x1;
|
||||
const v2y = y3 - y1;
|
||||
const v1x = x2 - x1;
|
||||
const v1y = y2 - y1;
|
||||
const v0x = px - x1;
|
||||
const v0y = py - y1;
|
||||
const dot00 = v2x * v2x + v2y * v2y;
|
||||
const dot01 = v2x * v1x + v2y * v1y;
|
||||
const dot02 = v2x * v0x + v2y * v0y;
|
||||
const dot11 = v1x * v1x + v1y * v1y;
|
||||
const dot12 = v1x * v0x + v1y * v0y;
|
||||
const invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
|
||||
const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||
const v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
||||
return u >= 0 && v >= 0 && u + v < 1;
|
||||
}
|
||||
|
||||
exports.pointInTriangle = pointInTriangle;
|
||||
//# sourceMappingURL=pointInTriangle.js.map
|
1
node_modules/pixi.js/lib/maths/point/pointInTriangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/pointInTriangle.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pointInTriangle.js","sources":["../../../src/maths/point/pointInTriangle.ts"],"sourcesContent":["/**\n * Check if a point is inside a triangle.\n * @param px - x coordinate of the point\n * @param py - y coordinate of the point\n * @param x1 - x coordinate of the first vertex of the triangle\n * @param y1 - y coordinate of the first vertex of the triangle\n * @param x2 - x coordinate of the second vertex of the triangle\n * @param y2 - y coordinate of the second vertex of the triangle\n * @param x3 - x coordinate of the third vertex of the triangle\n * @param y3 - y coordinate of the third vertex of the triangle\n * @returns `true` if the point is inside the triangle, `false` otherwise\n */\nexport function pointInTriangle(\n px: number, py: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number\n)\n{\n // Calculate vectors from point p to each vertex of the triangle\n const v2x = x3 - x1;\n const v2y = y3 - y1;\n const v1x = x2 - x1;\n const v1y = y2 - y1;\n const v0x = px - x1;\n const v0y = py - y1;\n\n // Compute dot products\n const dot00 = (v2x * v2x) + (v2y * v2y);\n const dot01 = (v2x * v1x) + (v2y * v1y);\n const dot02 = (v2x * v0x) + (v2y * v0y);\n const dot11 = (v1x * v1x) + (v1y * v1y);\n const dot12 = (v1x * v0x) + (v1y * v0y);\n\n // Calculate barycentric coordinates\n const invDenom = 1 / ((dot00 * dot11) - (dot01 * dot01));\n const u = ((dot11 * dot02) - (dot01 * dot12)) * invDenom;\n const v = ((dot00 * dot12) - (dot01 * dot02)) * invDenom;\n\n // Check if point is in triangle\n return (u >= 0) && (v >= 0) && (u + v < 1);\n}\n"],"names":[],"mappings":";;;AAYgB,SAAA,eAAA,CACZ,IAAY,EACZ,EAAA,EAAA,EAAY,IACZ,EAAY,EAAA,EAAA,EACZ,IAAY,EAEhB,EAAA;AAEI,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AAGjB,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AAGnC,EAAA,MAAM,QAAW,GAAA,CAAA,IAAM,KAAQ,GAAA,KAAA,GAAU,KAAQ,GAAA,KAAA,CAAA,CAAA;AACjD,EAAA,MAAM,CAAM,GAAA,CAAA,KAAA,GAAQ,KAAU,GAAA,KAAA,GAAQ,KAAU,IAAA,QAAA,CAAA;AAChD,EAAA,MAAM,CAAM,GAAA,CAAA,KAAA,GAAQ,KAAU,GAAA,KAAA,GAAQ,KAAU,IAAA,QAAA,CAAA;AAGhD,EAAA,OAAQ,CAAK,IAAA,CAAA,IAAO,CAAK,IAAA,CAAA,IAAO,IAAI,CAAI,GAAA,CAAA,CAAA;AAC5C;;;;"}
|
21
node_modules/pixi.js/lib/maths/point/pointInTriangle.mjs
generated
vendored
Normal file
21
node_modules/pixi.js/lib/maths/point/pointInTriangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
function pointInTriangle(px, py, x1, y1, x2, y2, x3, y3) {
|
||||
const v2x = x3 - x1;
|
||||
const v2y = y3 - y1;
|
||||
const v1x = x2 - x1;
|
||||
const v1y = y2 - y1;
|
||||
const v0x = px - x1;
|
||||
const v0y = py - y1;
|
||||
const dot00 = v2x * v2x + v2y * v2y;
|
||||
const dot01 = v2x * v1x + v2y * v1y;
|
||||
const dot02 = v2x * v0x + v2y * v0y;
|
||||
const dot11 = v1x * v1x + v1y * v1y;
|
||||
const dot12 = v1x * v0x + v1y * v0y;
|
||||
const invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
|
||||
const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||
const v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
||||
return u >= 0 && v >= 0 && u + v < 1;
|
||||
}
|
||||
|
||||
export { pointInTriangle };
|
||||
//# sourceMappingURL=pointInTriangle.mjs.map
|
1
node_modules/pixi.js/lib/maths/point/pointInTriangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/point/pointInTriangle.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pointInTriangle.mjs","sources":["../../../src/maths/point/pointInTriangle.ts"],"sourcesContent":["/**\n * Check if a point is inside a triangle.\n * @param px - x coordinate of the point\n * @param py - y coordinate of the point\n * @param x1 - x coordinate of the first vertex of the triangle\n * @param y1 - y coordinate of the first vertex of the triangle\n * @param x2 - x coordinate of the second vertex of the triangle\n * @param y2 - y coordinate of the second vertex of the triangle\n * @param x3 - x coordinate of the third vertex of the triangle\n * @param y3 - y coordinate of the third vertex of the triangle\n * @returns `true` if the point is inside the triangle, `false` otherwise\n */\nexport function pointInTriangle(\n px: number, py: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number\n)\n{\n // Calculate vectors from point p to each vertex of the triangle\n const v2x = x3 - x1;\n const v2y = y3 - y1;\n const v1x = x2 - x1;\n const v1y = y2 - y1;\n const v0x = px - x1;\n const v0y = py - y1;\n\n // Compute dot products\n const dot00 = (v2x * v2x) + (v2y * v2y);\n const dot01 = (v2x * v1x) + (v2y * v1y);\n const dot02 = (v2x * v0x) + (v2y * v0y);\n const dot11 = (v1x * v1x) + (v1y * v1y);\n const dot12 = (v1x * v0x) + (v1y * v0y);\n\n // Calculate barycentric coordinates\n const invDenom = 1 / ((dot00 * dot11) - (dot01 * dot01));\n const u = ((dot11 * dot02) - (dot01 * dot12)) * invDenom;\n const v = ((dot00 * dot12) - (dot01 * dot02)) * invDenom;\n\n // Check if point is in triangle\n return (u >= 0) && (v >= 0) && (u + v < 1);\n}\n"],"names":[],"mappings":";AAYgB,SAAA,eAAA,CACZ,IAAY,EACZ,EAAA,EAAA,EAAY,IACZ,EAAY,EAAA,EAAA,EACZ,IAAY,EAEhB,EAAA;AAEI,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AACjB,EAAA,MAAM,MAAM,EAAK,GAAA,EAAA,CAAA;AAGjB,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AACnC,EAAM,MAAA,KAAA,GAAS,GAAM,GAAA,GAAA,GAAQ,GAAM,GAAA,GAAA,CAAA;AAGnC,EAAA,MAAM,QAAW,GAAA,CAAA,IAAM,KAAQ,GAAA,KAAA,GAAU,KAAQ,GAAA,KAAA,CAAA,CAAA;AACjD,EAAA,MAAM,CAAM,GAAA,CAAA,KAAA,GAAQ,KAAU,GAAA,KAAA,GAAQ,KAAU,IAAA,QAAA,CAAA;AAChD,EAAA,MAAM,CAAM,GAAA,CAAA,KAAA,GAAQ,KAAU,GAAA,KAAA,GAAQ,KAAU,IAAA,QAAA,CAAA;AAGhD,EAAA,OAAQ,CAAK,IAAA,CAAA,IAAO,CAAK,IAAA,CAAA,IAAO,IAAI,CAAI,GAAA,CAAA,CAAA;AAC5C;;;;"}
|
74
node_modules/pixi.js/lib/maths/shapes/Circle.d.ts
generated
vendored
Normal file
74
node_modules/pixi.js/lib/maths/shapes/Circle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import { Rectangle } from './Rectangle';
|
||||
import type { SHAPE_PRIMITIVE } from '../misc/const';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
/**
|
||||
* The Circle object is used to help draw graphics and can also be used to specify a hit area for containers.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Circle implements ShapePrimitive {
|
||||
/**
|
||||
* The X coordinate of the center of this circle
|
||||
* @default 0
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* The Y coordinate of the center of this circle
|
||||
* @default 0
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The radius of the circle
|
||||
* @default 0
|
||||
*/
|
||||
radius: number;
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'circle'
|
||||
*/
|
||||
readonly type: SHAPE_PRIMITIVE;
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this circle
|
||||
* @param y - The Y coordinate of the center of this circle
|
||||
* @param radius - The radius of the circle
|
||||
*/
|
||||
constructor(x?: number, y?: number, radius?: number);
|
||||
/**
|
||||
* Creates a clone of this Circle instance
|
||||
* @returns A copy of the Circle
|
||||
*/
|
||||
clone(): Circle;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
strokeContains(x: number, y: number, width: number): boolean;
|
||||
/**
|
||||
* Returns the framing rectangle of the circle as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
/**
|
||||
* Copies another circle to this one.
|
||||
* @param circle - The circle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(circle: Circle): this;
|
||||
/**
|
||||
* Copies this circle to another one.
|
||||
* @param circle - The circle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(circle: Circle): Circle;
|
||||
toString(): string;
|
||||
}
|
101
node_modules/pixi.js/lib/maths/shapes/Circle.js
generated
vendored
Normal file
101
node_modules/pixi.js/lib/maths/shapes/Circle.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
|
||||
var Rectangle = require('./Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
class Circle {
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this circle
|
||||
* @param y - The Y coordinate of the center of this circle
|
||||
* @param radius - The radius of the circle
|
||||
*/
|
||||
constructor(x = 0, y = 0, radius = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'circle'
|
||||
*/
|
||||
this.type = "circle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Circle instance
|
||||
* @returns A copy of the Circle
|
||||
*/
|
||||
clone() {
|
||||
return new Circle(this.x, this.y, this.radius);
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.radius <= 0)
|
||||
return false;
|
||||
const r2 = this.radius * this.radius;
|
||||
let dx = this.x - x;
|
||||
let dy = this.y - y;
|
||||
dx *= dx;
|
||||
dy *= dy;
|
||||
return dx + dy <= r2;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
strokeContains(x, y, width) {
|
||||
if (this.radius === 0)
|
||||
return false;
|
||||
const dx = this.x - x;
|
||||
const dy = this.y - y;
|
||||
const r = this.radius;
|
||||
const w2 = width / 2;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
return distance < r + w2 && distance > r - w2;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the circle as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle.Rectangle();
|
||||
out.x = this.x - this.radius;
|
||||
out.y = this.y - this.radius;
|
||||
out.width = this.radius * 2;
|
||||
out.height = this.radius * 2;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another circle to this one.
|
||||
* @param circle - The circle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(circle) {
|
||||
this.x = circle.x;
|
||||
this.y = circle.y;
|
||||
this.radius = circle.radius;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this circle to another one.
|
||||
* @param circle - The circle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(circle) {
|
||||
circle.copyFrom(this);
|
||||
return circle;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Circle = Circle;
|
||||
//# sourceMappingURL=Circle.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/Circle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Circle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
99
node_modules/pixi.js/lib/maths/shapes/Circle.mjs
generated
vendored
Normal file
99
node_modules/pixi.js/lib/maths/shapes/Circle.mjs
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { Rectangle } from './Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
class Circle {
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this circle
|
||||
* @param y - The Y coordinate of the center of this circle
|
||||
* @param radius - The radius of the circle
|
||||
*/
|
||||
constructor(x = 0, y = 0, radius = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'circle'
|
||||
*/
|
||||
this.type = "circle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Circle instance
|
||||
* @returns A copy of the Circle
|
||||
*/
|
||||
clone() {
|
||||
return new Circle(this.x, this.y, this.radius);
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.radius <= 0)
|
||||
return false;
|
||||
const r2 = this.radius * this.radius;
|
||||
let dx = this.x - x;
|
||||
let dy = this.y - y;
|
||||
dx *= dx;
|
||||
dy *= dy;
|
||||
return dx + dy <= r2;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this circle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this Circle
|
||||
*/
|
||||
strokeContains(x, y, width) {
|
||||
if (this.radius === 0)
|
||||
return false;
|
||||
const dx = this.x - x;
|
||||
const dy = this.y - y;
|
||||
const r = this.radius;
|
||||
const w2 = width / 2;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
return distance < r + w2 && distance > r - w2;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the circle as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
out.x = this.x - this.radius;
|
||||
out.y = this.y - this.radius;
|
||||
out.width = this.radius * 2;
|
||||
out.height = this.radius * 2;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another circle to this one.
|
||||
* @param circle - The circle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(circle) {
|
||||
this.x = circle.x;
|
||||
this.y = circle.y;
|
||||
this.radius = circle.radius;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this circle to another one.
|
||||
* @param circle - The circle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(circle) {
|
||||
circle.copyFrom(this);
|
||||
return circle;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;
|
||||
}
|
||||
}
|
||||
|
||||
export { Circle };
|
||||
//# sourceMappingURL=Circle.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/Circle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Circle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
85
node_modules/pixi.js/lib/maths/shapes/Ellipse.d.ts
generated
vendored
Normal file
85
node_modules/pixi.js/lib/maths/shapes/Ellipse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
import { Rectangle } from './Rectangle';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
/**
|
||||
* The Ellipse object is used to help draw graphics and can also be used to specify a hit area for containers.
|
||||
* ```js
|
||||
* import { Ellipse } from 'pixi.js';
|
||||
*
|
||||
* const ellipse = new Ellipse(0, 0, 20, 10); // 40x20 rectangle
|
||||
* const isPointInEllipse = ellipse.contains(0, 0); // true
|
||||
* ```
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Ellipse implements ShapePrimitive {
|
||||
/**
|
||||
* The X coordinate of the center of this ellipse
|
||||
* @default 0
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* The Y coordinate of the center of this ellipse
|
||||
* @default 0
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The half width of this ellipse
|
||||
* @default 0
|
||||
*/
|
||||
halfWidth: number;
|
||||
/**
|
||||
* The half height of this ellipse
|
||||
* @default 0
|
||||
*/
|
||||
halfHeight: number;
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'ellipse'
|
||||
*/
|
||||
readonly type = "ellipse";
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this ellipse
|
||||
* @param y - The Y coordinate of the center of this ellipse
|
||||
* @param halfWidth - The half width of this ellipse
|
||||
* @param halfHeight - The half height of this ellipse
|
||||
*/
|
||||
constructor(x?: number, y?: number, halfWidth?: number, halfHeight?: number);
|
||||
/**
|
||||
* Creates a clone of this Ellipse instance
|
||||
* @returns {Ellipse} A copy of the ellipse
|
||||
*/
|
||||
clone(): Ellipse;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse including stroke
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
strokeContains(x: number, y: number, width: number): boolean;
|
||||
/**
|
||||
* Returns the framing rectangle of the ellipse as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
/**
|
||||
* Copies another ellipse to this one.
|
||||
* @param ellipse - The ellipse to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(ellipse: Ellipse): this;
|
||||
/**
|
||||
* Copies this ellipse to another one.
|
||||
* @param ellipse - The ellipse to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(ellipse: Ellipse): Ellipse;
|
||||
toString(): string;
|
||||
}
|
110
node_modules/pixi.js/lib/maths/shapes/Ellipse.js
generated
vendored
Normal file
110
node_modules/pixi.js/lib/maths/shapes/Ellipse.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
'use strict';
|
||||
|
||||
var Rectangle = require('./Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
class Ellipse {
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this ellipse
|
||||
* @param y - The Y coordinate of the center of this ellipse
|
||||
* @param halfWidth - The half width of this ellipse
|
||||
* @param halfHeight - The half height of this ellipse
|
||||
*/
|
||||
constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'ellipse'
|
||||
*/
|
||||
this.type = "ellipse";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.halfWidth = halfWidth;
|
||||
this.halfHeight = halfHeight;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Ellipse instance
|
||||
* @returns {Ellipse} A copy of the ellipse
|
||||
*/
|
||||
clone() {
|
||||
return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.halfWidth <= 0 || this.halfHeight <= 0) {
|
||||
return false;
|
||||
}
|
||||
let normx = (x - this.x) / this.halfWidth;
|
||||
let normy = (y - this.y) / this.halfHeight;
|
||||
normx *= normx;
|
||||
normy *= normy;
|
||||
return normx + normy <= 1;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse including stroke
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
strokeContains(x, y, width) {
|
||||
const { halfWidth, halfHeight } = this;
|
||||
if (halfWidth <= 0 || halfHeight <= 0) {
|
||||
return false;
|
||||
}
|
||||
const halfStrokeWidth = width / 2;
|
||||
const innerA = halfWidth - halfStrokeWidth;
|
||||
const innerB = halfHeight - halfStrokeWidth;
|
||||
const outerA = halfWidth + halfStrokeWidth;
|
||||
const outerB = halfHeight + halfStrokeWidth;
|
||||
const normalizedX = x - this.x;
|
||||
const normalizedY = y - this.y;
|
||||
const innerEllipse = normalizedX * normalizedX / (innerA * innerA) + normalizedY * normalizedY / (innerB * innerB);
|
||||
const outerEllipse = normalizedX * normalizedX / (outerA * outerA) + normalizedY * normalizedY / (outerB * outerB);
|
||||
return innerEllipse > 1 && outerEllipse <= 1;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the ellipse as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle.Rectangle();
|
||||
out.x = this.x - this.halfWidth;
|
||||
out.y = this.y - this.halfHeight;
|
||||
out.width = this.halfWidth * 2;
|
||||
out.height = this.halfHeight * 2;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another ellipse to this one.
|
||||
* @param ellipse - The ellipse to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(ellipse) {
|
||||
this.x = ellipse.x;
|
||||
this.y = ellipse.y;
|
||||
this.halfWidth = ellipse.halfWidth;
|
||||
this.halfHeight = ellipse.halfHeight;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this ellipse to another one.
|
||||
* @param ellipse - The ellipse to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(ellipse) {
|
||||
ellipse.copyFrom(this);
|
||||
return ellipse;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Ellipse = Ellipse;
|
||||
//# sourceMappingURL=Ellipse.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/Ellipse.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Ellipse.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
108
node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs
generated
vendored
Normal file
108
node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
import { Rectangle } from './Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
class Ellipse {
|
||||
/**
|
||||
* @param x - The X coordinate of the center of this ellipse
|
||||
* @param y - The Y coordinate of the center of this ellipse
|
||||
* @param halfWidth - The half width of this ellipse
|
||||
* @param halfHeight - The half height of this ellipse
|
||||
*/
|
||||
constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'ellipse'
|
||||
*/
|
||||
this.type = "ellipse";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.halfWidth = halfWidth;
|
||||
this.halfHeight = halfHeight;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Ellipse instance
|
||||
* @returns {Ellipse} A copy of the ellipse
|
||||
*/
|
||||
clone() {
|
||||
return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.halfWidth <= 0 || this.halfHeight <= 0) {
|
||||
return false;
|
||||
}
|
||||
let normx = (x - this.x) / this.halfWidth;
|
||||
let normy = (y - this.y) / this.halfHeight;
|
||||
normx *= normx;
|
||||
normy *= normy;
|
||||
return normx + normy <= 1;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this ellipse including stroke
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param width
|
||||
* @returns Whether the x/y coords are within this ellipse
|
||||
*/
|
||||
strokeContains(x, y, width) {
|
||||
const { halfWidth, halfHeight } = this;
|
||||
if (halfWidth <= 0 || halfHeight <= 0) {
|
||||
return false;
|
||||
}
|
||||
const halfStrokeWidth = width / 2;
|
||||
const innerA = halfWidth - halfStrokeWidth;
|
||||
const innerB = halfHeight - halfStrokeWidth;
|
||||
const outerA = halfWidth + halfStrokeWidth;
|
||||
const outerB = halfHeight + halfStrokeWidth;
|
||||
const normalizedX = x - this.x;
|
||||
const normalizedY = y - this.y;
|
||||
const innerEllipse = normalizedX * normalizedX / (innerA * innerA) + normalizedY * normalizedY / (innerB * innerB);
|
||||
const outerEllipse = normalizedX * normalizedX / (outerA * outerA) + normalizedY * normalizedY / (outerB * outerB);
|
||||
return innerEllipse > 1 && outerEllipse <= 1;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the ellipse as a Rectangle object
|
||||
* @param out
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
out.x = this.x - this.halfWidth;
|
||||
out.y = this.y - this.halfHeight;
|
||||
out.width = this.halfWidth * 2;
|
||||
out.height = this.halfHeight * 2;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another ellipse to this one.
|
||||
* @param ellipse - The ellipse to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(ellipse) {
|
||||
this.x = ellipse.x;
|
||||
this.y = ellipse.y;
|
||||
this.halfWidth = ellipse.halfWidth;
|
||||
this.halfHeight = ellipse.halfHeight;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this ellipse to another one.
|
||||
* @param ellipse - The ellipse to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(ellipse) {
|
||||
ellipse.copyFrom(this);
|
||||
return ellipse;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;
|
||||
}
|
||||
}
|
||||
|
||||
export { Ellipse };
|
||||
//# sourceMappingURL=Ellipse.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
99
node_modules/pixi.js/lib/maths/shapes/Polygon.d.ts
generated
vendored
Normal file
99
node_modules/pixi.js/lib/maths/shapes/Polygon.d.ts
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { Rectangle } from './Rectangle';
|
||||
import type { SHAPE_PRIMITIVE } from '../misc/const';
|
||||
import type { PointData } from '../point/PointData';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
/**
|
||||
* A class to define a shape via user defined coordinates.
|
||||
*
|
||||
*
|
||||
* `Polygon` can accept the following different constructor arguments:
|
||||
* - An array of `Point` objects
|
||||
* - An array of coordinate pairs
|
||||
*
|
||||
*
|
||||
* These can be passed as a single array, or as a sequence of arguments.
|
||||
* ```js
|
||||
* import { Polygon } from 'pixi.js';
|
||||
*
|
||||
* // create a polygon object from an array of points, or an array of coordinate pairs
|
||||
* const polygon1 = new Polygon([ new Point(0, 0), new Point(0, 100), new Point(100, 100) ]);
|
||||
* const polygon2 = new Polygon([ 0, 0, 0, 100, 100, 100 ]);
|
||||
*
|
||||
* // or create a polygon object from a sequence of points, or coordinate pairs
|
||||
* const polygon3 = new Polygon(new Point(0, 0), new Point(0, 100), new Point(100, 100));
|
||||
* const polygon4 = new Polygon(0, 0, 0, 100, 100, 100);
|
||||
* ```
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Polygon implements ShapePrimitive {
|
||||
/** An array of the points of this polygon. */
|
||||
points: number[];
|
||||
/** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */
|
||||
closePath: boolean;
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'polygon'
|
||||
*/
|
||||
readonly type: SHAPE_PRIMITIVE;
|
||||
constructor(points: PointData[] | number[]);
|
||||
constructor(...points: PointData[] | number[]);
|
||||
/**
|
||||
* Creates a clone of this polygon.
|
||||
* @returns - A copy of the polygon.
|
||||
*/
|
||||
clone(): Polygon;
|
||||
/**
|
||||
* Checks whether the x and y coordinates passed to this function are contained within this polygon.
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this polygon.
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this polygon including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this polygon
|
||||
*/
|
||||
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
||||
/**
|
||||
* Returns the framing rectangle of the polygon as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
/**
|
||||
* Copies another polygon to this one.
|
||||
* @param polygon - The polygon to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(polygon: Polygon): this;
|
||||
/**
|
||||
* Copies this polygon to another one.
|
||||
* @param polygon - The polygon to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(polygon: Polygon): Polygon;
|
||||
toString(): string;
|
||||
/**
|
||||
* Get the last X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastX(): number;
|
||||
/**
|
||||
* Get the last Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastY(): number;
|
||||
/**
|
||||
* Get the first X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get x(): number;
|
||||
/**
|
||||
* Get the first Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get y(): number;
|
||||
}
|
166
node_modules/pixi.js/lib/maths/shapes/Polygon.js
generated
vendored
Normal file
166
node_modules/pixi.js/lib/maths/shapes/Polygon.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
'use strict';
|
||||
|
||||
var squaredDistanceToLineSegment = require('../misc/squaredDistanceToLineSegment.js');
|
||||
var Rectangle = require('./Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
class Polygon {
|
||||
/**
|
||||
* @param points - This can be an array of Points
|
||||
* that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or
|
||||
* the arguments passed can be all the points of the polygon e.g.
|
||||
* `new Polygon(new Point(), new Point(), ...)`, or the arguments passed can be flat
|
||||
* x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.
|
||||
*/
|
||||
constructor(...points) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'polygon'
|
||||
*/
|
||||
this.type = "polygon";
|
||||
let flat = Array.isArray(points[0]) ? points[0] : points;
|
||||
if (typeof flat[0] !== "number") {
|
||||
const p = [];
|
||||
for (let i = 0, il = flat.length; i < il; i++) {
|
||||
p.push(flat[i].x, flat[i].y);
|
||||
}
|
||||
flat = p;
|
||||
}
|
||||
this.points = flat;
|
||||
this.closePath = true;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this polygon.
|
||||
* @returns - A copy of the polygon.
|
||||
*/
|
||||
clone() {
|
||||
const points = this.points.slice();
|
||||
const polygon = new Polygon(points);
|
||||
polygon.closePath = this.closePath;
|
||||
return polygon;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates passed to this function are contained within this polygon.
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this polygon.
|
||||
*/
|
||||
contains(x, y) {
|
||||
let inside = false;
|
||||
const length = this.points.length / 2;
|
||||
for (let i = 0, j = length - 1; i < length; j = i++) {
|
||||
const xi = this.points[i * 2];
|
||||
const yi = this.points[i * 2 + 1];
|
||||
const xj = this.points[j * 2];
|
||||
const yj = this.points[j * 2 + 1];
|
||||
const intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi;
|
||||
if (intersect) {
|
||||
inside = !inside;
|
||||
}
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this polygon including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this polygon
|
||||
*/
|
||||
strokeContains(x, y, strokeWidth) {
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const halfStrokeWidthSqrd = halfStrokeWidth * halfStrokeWidth;
|
||||
const { points } = this;
|
||||
const iterationLength = points.length - (this.closePath ? 0 : 2);
|
||||
for (let i = 0; i < iterationLength; i += 2) {
|
||||
const x1 = points[i];
|
||||
const y1 = points[i + 1];
|
||||
const x2 = points[(i + 2) % points.length];
|
||||
const y2 = points[(i + 3) % points.length];
|
||||
const distanceSqrd = squaredDistanceToLineSegment.squaredDistanceToLineSegment(x, y, x1, y1, x2, y2);
|
||||
if (distanceSqrd <= halfStrokeWidthSqrd) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the polygon as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle.Rectangle();
|
||||
const points = this.points;
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let minY = Infinity;
|
||||
let maxY = -Infinity;
|
||||
for (let i = 0, n = points.length; i < n; i += 2) {
|
||||
const x = points[i];
|
||||
const y = points[i + 1];
|
||||
minX = x < minX ? x : minX;
|
||||
maxX = x > maxX ? x : maxX;
|
||||
minY = y < minY ? y : minY;
|
||||
maxY = y > maxY ? y : maxY;
|
||||
}
|
||||
out.x = minX;
|
||||
out.width = maxX - minX;
|
||||
out.y = minY;
|
||||
out.height = maxY - minY;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another polygon to this one.
|
||||
* @param polygon - The polygon to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(polygon) {
|
||||
this.points = polygon.points.slice();
|
||||
this.closePath = polygon.closePath;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this polygon to another one.
|
||||
* @param polygon - The polygon to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(polygon) {
|
||||
polygon.copyFrom(this);
|
||||
return polygon;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, "")}]`;
|
||||
}
|
||||
/**
|
||||
* Get the last X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastX() {
|
||||
return this.points[this.points.length - 2];
|
||||
}
|
||||
/**
|
||||
* Get the last Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastY() {
|
||||
return this.points[this.points.length - 1];
|
||||
}
|
||||
/**
|
||||
* Get the first X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get x() {
|
||||
return this.points[this.points.length - 2];
|
||||
}
|
||||
/**
|
||||
* Get the first Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get y() {
|
||||
return this.points[this.points.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
exports.Polygon = Polygon;
|
||||
//# sourceMappingURL=Polygon.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/Polygon.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Polygon.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
164
node_modules/pixi.js/lib/maths/shapes/Polygon.mjs
generated
vendored
Normal file
164
node_modules/pixi.js/lib/maths/shapes/Polygon.mjs
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
import { squaredDistanceToLineSegment } from '../misc/squaredDistanceToLineSegment.mjs';
|
||||
import { Rectangle } from './Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
class Polygon {
|
||||
/**
|
||||
* @param points - This can be an array of Points
|
||||
* that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or
|
||||
* the arguments passed can be all the points of the polygon e.g.
|
||||
* `new Polygon(new Point(), new Point(), ...)`, or the arguments passed can be flat
|
||||
* x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.
|
||||
*/
|
||||
constructor(...points) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'polygon'
|
||||
*/
|
||||
this.type = "polygon";
|
||||
let flat = Array.isArray(points[0]) ? points[0] : points;
|
||||
if (typeof flat[0] !== "number") {
|
||||
const p = [];
|
||||
for (let i = 0, il = flat.length; i < il; i++) {
|
||||
p.push(flat[i].x, flat[i].y);
|
||||
}
|
||||
flat = p;
|
||||
}
|
||||
this.points = flat;
|
||||
this.closePath = true;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this polygon.
|
||||
* @returns - A copy of the polygon.
|
||||
*/
|
||||
clone() {
|
||||
const points = this.points.slice();
|
||||
const polygon = new Polygon(points);
|
||||
polygon.closePath = this.closePath;
|
||||
return polygon;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates passed to this function are contained within this polygon.
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this polygon.
|
||||
*/
|
||||
contains(x, y) {
|
||||
let inside = false;
|
||||
const length = this.points.length / 2;
|
||||
for (let i = 0, j = length - 1; i < length; j = i++) {
|
||||
const xi = this.points[i * 2];
|
||||
const yi = this.points[i * 2 + 1];
|
||||
const xj = this.points[j * 2];
|
||||
const yj = this.points[j * 2 + 1];
|
||||
const intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi;
|
||||
if (intersect) {
|
||||
inside = !inside;
|
||||
}
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this polygon including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this polygon
|
||||
*/
|
||||
strokeContains(x, y, strokeWidth) {
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const halfStrokeWidthSqrd = halfStrokeWidth * halfStrokeWidth;
|
||||
const { points } = this;
|
||||
const iterationLength = points.length - (this.closePath ? 0 : 2);
|
||||
for (let i = 0; i < iterationLength; i += 2) {
|
||||
const x1 = points[i];
|
||||
const y1 = points[i + 1];
|
||||
const x2 = points[(i + 2) % points.length];
|
||||
const y2 = points[(i + 3) % points.length];
|
||||
const distanceSqrd = squaredDistanceToLineSegment(x, y, x1, y1, x2, y2);
|
||||
if (distanceSqrd <= halfStrokeWidthSqrd) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the polygon as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
const points = this.points;
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let minY = Infinity;
|
||||
let maxY = -Infinity;
|
||||
for (let i = 0, n = points.length; i < n; i += 2) {
|
||||
const x = points[i];
|
||||
const y = points[i + 1];
|
||||
minX = x < minX ? x : minX;
|
||||
maxX = x > maxX ? x : maxX;
|
||||
minY = y < minY ? y : minY;
|
||||
maxY = y > maxY ? y : maxY;
|
||||
}
|
||||
out.x = minX;
|
||||
out.width = maxX - minX;
|
||||
out.y = minY;
|
||||
out.height = maxY - minY;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Copies another polygon to this one.
|
||||
* @param polygon - The polygon to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(polygon) {
|
||||
this.points = polygon.points.slice();
|
||||
this.closePath = polygon.closePath;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this polygon to another one.
|
||||
* @param polygon - The polygon to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(polygon) {
|
||||
polygon.copyFrom(this);
|
||||
return polygon;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, "")}]`;
|
||||
}
|
||||
/**
|
||||
* Get the last X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastX() {
|
||||
return this.points[this.points.length - 2];
|
||||
}
|
||||
/**
|
||||
* Get the last Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get lastY() {
|
||||
return this.points[this.points.length - 1];
|
||||
}
|
||||
/**
|
||||
* Get the first X coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get x() {
|
||||
return this.points[this.points.length - 2];
|
||||
}
|
||||
/**
|
||||
* Get the first Y coordinate of the polygon
|
||||
* @readonly
|
||||
*/
|
||||
get y() {
|
||||
return this.points[this.points.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
export { Polygon };
|
||||
//# sourceMappingURL=Polygon.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/Polygon.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Polygon.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
142
node_modules/pixi.js/lib/maths/shapes/Rectangle.d.ts
generated
vendored
Normal file
142
node_modules/pixi.js/lib/maths/shapes/Rectangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
import type { Bounds } from '../../scene/container/bounds/Bounds';
|
||||
import type { Matrix } from '../matrix/Matrix';
|
||||
import type { SHAPE_PRIMITIVE } from '../misc/const';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
export interface Rectangle extends PixiMixins.Rectangle {
|
||||
}
|
||||
/**
|
||||
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
||||
* point (`x`, `y`) and by its `width` and its `height`.
|
||||
*
|
||||
* It also provides convenience methods to get and set the position and size of the rectangle such as
|
||||
* {@link maths.Rectangle#bottom|bottom}, {@link maths.Rectangle#right|right} and {@link maths.Rectangle#isEmpty|isEmpty}.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Rectangle implements ShapePrimitive {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'rectangle'
|
||||
*/
|
||||
readonly type: SHAPE_PRIMITIVE;
|
||||
/**
|
||||
* The X coordinate of the upper-left corner of the rectangle
|
||||
* @default 0
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* The Y coordinate of the upper-left corner of the rectangle
|
||||
* @default 0
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The overall width of this rectangle
|
||||
* @default 0
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* The overall height of this rectangle
|
||||
* @default 0
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
||||
* @param width - The overall width of the rectangle
|
||||
* @param height - The overall height of the rectangle
|
||||
*/
|
||||
constructor(x?: string | number, y?: string | number, width?: string | number, height?: string | number);
|
||||
/** Returns the left edge of the rectangle. */
|
||||
get left(): number;
|
||||
/** Returns the right edge of the rectangle. */
|
||||
get right(): number;
|
||||
/** Returns the top edge of the rectangle. */
|
||||
get top(): number;
|
||||
/** Returns the bottom edge of the rectangle. */
|
||||
get bottom(): number;
|
||||
/** Determines whether the Rectangle is empty. */
|
||||
isEmpty(): boolean;
|
||||
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
||||
static get EMPTY(): Rectangle;
|
||||
/**
|
||||
* Creates a clone of this Rectangle
|
||||
* @returns a copy of the rectangle
|
||||
*/
|
||||
clone(): Rectangle;
|
||||
/**
|
||||
* Converts a Bounds object to a Rectangle object.
|
||||
* @param bounds - The bounds to copy and convert to a rectangle.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFromBounds(bounds: Bounds): this;
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle: Rectangle): Rectangle;
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle: Rectangle): Rectangle;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rectangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Rectangle
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
||||
/**
|
||||
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
||||
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
||||
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
||||
* (width or height equal to zero) can't intersect any other rectangle.
|
||||
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
||||
* @param {Matrix} transform - The transformation matrix of `other`.
|
||||
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
||||
*/
|
||||
intersects(other: Rectangle, transform?: Matrix): boolean;
|
||||
/**
|
||||
* Pads the rectangle making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
pad(paddingX?: number, paddingY?: number): this;
|
||||
/**
|
||||
* Fits this rectangle around the passed one.
|
||||
* @param rectangle - The rectangle to fit.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
fit(rectangle: Rectangle): this;
|
||||
/**
|
||||
* Enlarges rectangle that way its corners lie on grid
|
||||
* @param resolution - resolution
|
||||
* @param eps - precision
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
ceil(resolution?: number, eps?: number): this;
|
||||
/**
|
||||
* Enlarges this rectangle to include the passed rectangle.
|
||||
* @param rectangle - The rectangle to include.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
enlarge(rectangle: Rectangle): this;
|
||||
/**
|
||||
* Returns the framing rectangle of the rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
toString(): string;
|
||||
}
|
271
node_modules/pixi.js/lib/maths/shapes/Rectangle.js
generated
vendored
Normal file
271
node_modules/pixi.js/lib/maths/shapes/Rectangle.js
generated
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
'use strict';
|
||||
|
||||
var Point = require('../point/Point.js');
|
||||
|
||||
"use strict";
|
||||
const tempPoints = [new Point.Point(), new Point.Point(), new Point.Point(), new Point.Point()];
|
||||
class Rectangle {
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
||||
* @param width - The overall width of the rectangle
|
||||
* @param height - The overall height of the rectangle
|
||||
*/
|
||||
constructor(x = 0, y = 0, width = 0, height = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'rectangle'
|
||||
*/
|
||||
this.type = "rectangle";
|
||||
this.x = Number(x);
|
||||
this.y = Number(y);
|
||||
this.width = Number(width);
|
||||
this.height = Number(height);
|
||||
}
|
||||
/** Returns the left edge of the rectangle. */
|
||||
get left() {
|
||||
return this.x;
|
||||
}
|
||||
/** Returns the right edge of the rectangle. */
|
||||
get right() {
|
||||
return this.x + this.width;
|
||||
}
|
||||
/** Returns the top edge of the rectangle. */
|
||||
get top() {
|
||||
return this.y;
|
||||
}
|
||||
/** Returns the bottom edge of the rectangle. */
|
||||
get bottom() {
|
||||
return this.y + this.height;
|
||||
}
|
||||
/** Determines whether the Rectangle is empty. */
|
||||
isEmpty() {
|
||||
return this.left === this.right || this.top === this.bottom;
|
||||
}
|
||||
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
||||
static get EMPTY() {
|
||||
return new Rectangle(0, 0, 0, 0);
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Rectangle
|
||||
* @returns a copy of the rectangle
|
||||
*/
|
||||
clone() {
|
||||
return new Rectangle(this.x, this.y, this.width, this.height);
|
||||
}
|
||||
/**
|
||||
* Converts a Bounds object to a Rectangle object.
|
||||
* @param bounds - The bounds to copy and convert to a rectangle.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFromBounds(bounds) {
|
||||
this.x = bounds.minX;
|
||||
this.y = bounds.minY;
|
||||
this.width = bounds.maxX - bounds.minX;
|
||||
this.height = bounds.maxY - bounds.minY;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle) {
|
||||
this.x = rectangle.x;
|
||||
this.y = rectangle.y;
|
||||
this.width = rectangle.width;
|
||||
this.height = rectangle.height;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle) {
|
||||
rectangle.copyFrom(this);
|
||||
return rectangle;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rectangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Rectangle
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.width <= 0 || this.height <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= this.x && x < this.x + this.width) {
|
||||
if (y >= this.y && y < this.y + this.height) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(x, y, strokeWidth) {
|
||||
const { width, height } = this;
|
||||
if (width <= 0 || height <= 0)
|
||||
return false;
|
||||
const _x = this.x;
|
||||
const _y = this.y;
|
||||
const outerLeft = _x - strokeWidth / 2;
|
||||
const outerRight = _x + width + strokeWidth / 2;
|
||||
const outerTop = _y - strokeWidth / 2;
|
||||
const outerBottom = _y + height + strokeWidth / 2;
|
||||
const innerLeft = _x + strokeWidth / 2;
|
||||
const innerRight = _x + width - strokeWidth / 2;
|
||||
const innerTop = _y + strokeWidth / 2;
|
||||
const innerBottom = _y + height - strokeWidth / 2;
|
||||
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
||||
}
|
||||
/**
|
||||
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
||||
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
||||
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
||||
* (width or height equal to zero) can't intersect any other rectangle.
|
||||
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
||||
* @param {Matrix} transform - The transformation matrix of `other`.
|
||||
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
||||
*/
|
||||
intersects(other, transform) {
|
||||
if (!transform) {
|
||||
const x02 = this.x < other.x ? other.x : this.x;
|
||||
const x12 = this.right > other.right ? other.right : this.right;
|
||||
if (x12 <= x02) {
|
||||
return false;
|
||||
}
|
||||
const y02 = this.y < other.y ? other.y : this.y;
|
||||
const y12 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
||||
return y12 > y02;
|
||||
}
|
||||
const x0 = this.left;
|
||||
const x1 = this.right;
|
||||
const y0 = this.top;
|
||||
const y1 = this.bottom;
|
||||
if (x1 <= x0 || y1 <= y0) {
|
||||
return false;
|
||||
}
|
||||
const lt = tempPoints[0].set(other.left, other.top);
|
||||
const lb = tempPoints[1].set(other.left, other.bottom);
|
||||
const rt = tempPoints[2].set(other.right, other.top);
|
||||
const rb = tempPoints[3].set(other.right, other.bottom);
|
||||
if (rt.x <= lt.x || lb.y <= lt.y) {
|
||||
return false;
|
||||
}
|
||||
const s = Math.sign(transform.a * transform.d - transform.b * transform.c);
|
||||
if (s === 0) {
|
||||
return false;
|
||||
}
|
||||
transform.apply(lt, lt);
|
||||
transform.apply(lb, lb);
|
||||
transform.apply(rt, rt);
|
||||
transform.apply(rb, rb);
|
||||
if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
||||
return false;
|
||||
}
|
||||
const nx = s * (lb.y - lt.y);
|
||||
const ny = s * (lt.x - lb.x);
|
||||
const n00 = nx * x0 + ny * y0;
|
||||
const n10 = nx * x1 + ny * y0;
|
||||
const n01 = nx * x0 + ny * y1;
|
||||
const n11 = nx * x1 + ny * y1;
|
||||
if (Math.max(n00, n10, n01, n11) <= nx * lt.x + ny * lt.y || Math.min(n00, n10, n01, n11) >= nx * rb.x + ny * rb.y) {
|
||||
return false;
|
||||
}
|
||||
const mx = s * (lt.y - rt.y);
|
||||
const my = s * (rt.x - lt.x);
|
||||
const m00 = mx * x0 + my * y0;
|
||||
const m10 = mx * x1 + my * y0;
|
||||
const m01 = mx * x0 + my * y1;
|
||||
const m11 = mx * x1 + my * y1;
|
||||
if (Math.max(m00, m10, m01, m11) <= mx * lt.x + my * lt.y || Math.min(m00, m10, m01, m11) >= mx * rb.x + my * rb.y) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Pads the rectangle making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
pad(paddingX = 0, paddingY = paddingX) {
|
||||
this.x -= paddingX;
|
||||
this.y -= paddingY;
|
||||
this.width += paddingX * 2;
|
||||
this.height += paddingY * 2;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Fits this rectangle around the passed one.
|
||||
* @param rectangle - The rectangle to fit.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
fit(rectangle) {
|
||||
const x1 = Math.max(this.x, rectangle.x);
|
||||
const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
||||
const y1 = Math.max(this.y, rectangle.y);
|
||||
const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
||||
this.x = x1;
|
||||
this.width = Math.max(x2 - x1, 0);
|
||||
this.y = y1;
|
||||
this.height = Math.max(y2 - y1, 0);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Enlarges rectangle that way its corners lie on grid
|
||||
* @param resolution - resolution
|
||||
* @param eps - precision
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
ceil(resolution = 1, eps = 1e-3) {
|
||||
const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
||||
const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
||||
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
||||
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
||||
this.width = x2 - this.x;
|
||||
this.height = y2 - this.y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Enlarges this rectangle to include the passed rectangle.
|
||||
* @param rectangle - The rectangle to include.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
enlarge(rectangle) {
|
||||
const x1 = Math.min(this.x, rectangle.x);
|
||||
const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
||||
const y1 = Math.min(this.y, rectangle.y);
|
||||
const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
||||
this.x = x1;
|
||||
this.width = x2 - x1;
|
||||
this.y = y1;
|
||||
this.height = y2 - y1;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
out.copyFrom(this);
|
||||
return out;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Rectangle = Rectangle;
|
||||
//# sourceMappingURL=Rectangle.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/Rectangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Rectangle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
269
node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs
generated
vendored
Normal file
269
node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
import { Point } from '../point/Point.mjs';
|
||||
|
||||
"use strict";
|
||||
const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
||||
class Rectangle {
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
||||
* @param width - The overall width of the rectangle
|
||||
* @param height - The overall height of the rectangle
|
||||
*/
|
||||
constructor(x = 0, y = 0, width = 0, height = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'rectangle'
|
||||
*/
|
||||
this.type = "rectangle";
|
||||
this.x = Number(x);
|
||||
this.y = Number(y);
|
||||
this.width = Number(width);
|
||||
this.height = Number(height);
|
||||
}
|
||||
/** Returns the left edge of the rectangle. */
|
||||
get left() {
|
||||
return this.x;
|
||||
}
|
||||
/** Returns the right edge of the rectangle. */
|
||||
get right() {
|
||||
return this.x + this.width;
|
||||
}
|
||||
/** Returns the top edge of the rectangle. */
|
||||
get top() {
|
||||
return this.y;
|
||||
}
|
||||
/** Returns the bottom edge of the rectangle. */
|
||||
get bottom() {
|
||||
return this.y + this.height;
|
||||
}
|
||||
/** Determines whether the Rectangle is empty. */
|
||||
isEmpty() {
|
||||
return this.left === this.right || this.top === this.bottom;
|
||||
}
|
||||
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
||||
static get EMPTY() {
|
||||
return new Rectangle(0, 0, 0, 0);
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Rectangle
|
||||
* @returns a copy of the rectangle
|
||||
*/
|
||||
clone() {
|
||||
return new Rectangle(this.x, this.y, this.width, this.height);
|
||||
}
|
||||
/**
|
||||
* Converts a Bounds object to a Rectangle object.
|
||||
* @param bounds - The bounds to copy and convert to a rectangle.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFromBounds(bounds) {
|
||||
this.x = bounds.minX;
|
||||
this.y = bounds.minY;
|
||||
this.width = bounds.maxX - bounds.minX;
|
||||
this.height = bounds.maxY - bounds.minY;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle) {
|
||||
this.x = rectangle.x;
|
||||
this.y = rectangle.y;
|
||||
this.width = rectangle.width;
|
||||
this.height = rectangle.height;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle) {
|
||||
rectangle.copyFrom(this);
|
||||
return rectangle;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rectangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Rectangle
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.width <= 0 || this.height <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= this.x && x < this.x + this.width) {
|
||||
if (y >= this.y && y < this.y + this.height) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(x, y, strokeWidth) {
|
||||
const { width, height } = this;
|
||||
if (width <= 0 || height <= 0)
|
||||
return false;
|
||||
const _x = this.x;
|
||||
const _y = this.y;
|
||||
const outerLeft = _x - strokeWidth / 2;
|
||||
const outerRight = _x + width + strokeWidth / 2;
|
||||
const outerTop = _y - strokeWidth / 2;
|
||||
const outerBottom = _y + height + strokeWidth / 2;
|
||||
const innerLeft = _x + strokeWidth / 2;
|
||||
const innerRight = _x + width - strokeWidth / 2;
|
||||
const innerTop = _y + strokeWidth / 2;
|
||||
const innerBottom = _y + height - strokeWidth / 2;
|
||||
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
||||
}
|
||||
/**
|
||||
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
||||
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
||||
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
||||
* (width or height equal to zero) can't intersect any other rectangle.
|
||||
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
||||
* @param {Matrix} transform - The transformation matrix of `other`.
|
||||
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
||||
*/
|
||||
intersects(other, transform) {
|
||||
if (!transform) {
|
||||
const x02 = this.x < other.x ? other.x : this.x;
|
||||
const x12 = this.right > other.right ? other.right : this.right;
|
||||
if (x12 <= x02) {
|
||||
return false;
|
||||
}
|
||||
const y02 = this.y < other.y ? other.y : this.y;
|
||||
const y12 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
||||
return y12 > y02;
|
||||
}
|
||||
const x0 = this.left;
|
||||
const x1 = this.right;
|
||||
const y0 = this.top;
|
||||
const y1 = this.bottom;
|
||||
if (x1 <= x0 || y1 <= y0) {
|
||||
return false;
|
||||
}
|
||||
const lt = tempPoints[0].set(other.left, other.top);
|
||||
const lb = tempPoints[1].set(other.left, other.bottom);
|
||||
const rt = tempPoints[2].set(other.right, other.top);
|
||||
const rb = tempPoints[3].set(other.right, other.bottom);
|
||||
if (rt.x <= lt.x || lb.y <= lt.y) {
|
||||
return false;
|
||||
}
|
||||
const s = Math.sign(transform.a * transform.d - transform.b * transform.c);
|
||||
if (s === 0) {
|
||||
return false;
|
||||
}
|
||||
transform.apply(lt, lt);
|
||||
transform.apply(lb, lb);
|
||||
transform.apply(rt, rt);
|
||||
transform.apply(rb, rb);
|
||||
if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
||||
return false;
|
||||
}
|
||||
const nx = s * (lb.y - lt.y);
|
||||
const ny = s * (lt.x - lb.x);
|
||||
const n00 = nx * x0 + ny * y0;
|
||||
const n10 = nx * x1 + ny * y0;
|
||||
const n01 = nx * x0 + ny * y1;
|
||||
const n11 = nx * x1 + ny * y1;
|
||||
if (Math.max(n00, n10, n01, n11) <= nx * lt.x + ny * lt.y || Math.min(n00, n10, n01, n11) >= nx * rb.x + ny * rb.y) {
|
||||
return false;
|
||||
}
|
||||
const mx = s * (lt.y - rt.y);
|
||||
const my = s * (rt.x - lt.x);
|
||||
const m00 = mx * x0 + my * y0;
|
||||
const m10 = mx * x1 + my * y0;
|
||||
const m01 = mx * x0 + my * y1;
|
||||
const m11 = mx * x1 + my * y1;
|
||||
if (Math.max(m00, m10, m01, m11) <= mx * lt.x + my * lt.y || Math.min(m00, m10, m01, m11) >= mx * rb.x + my * rb.y) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Pads the rectangle making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
pad(paddingX = 0, paddingY = paddingX) {
|
||||
this.x -= paddingX;
|
||||
this.y -= paddingY;
|
||||
this.width += paddingX * 2;
|
||||
this.height += paddingY * 2;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Fits this rectangle around the passed one.
|
||||
* @param rectangle - The rectangle to fit.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
fit(rectangle) {
|
||||
const x1 = Math.max(this.x, rectangle.x);
|
||||
const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
||||
const y1 = Math.max(this.y, rectangle.y);
|
||||
const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
||||
this.x = x1;
|
||||
this.width = Math.max(x2 - x1, 0);
|
||||
this.y = y1;
|
||||
this.height = Math.max(y2 - y1, 0);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Enlarges rectangle that way its corners lie on grid
|
||||
* @param resolution - resolution
|
||||
* @param eps - precision
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
ceil(resolution = 1, eps = 1e-3) {
|
||||
const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
||||
const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
||||
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
||||
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
||||
this.width = x2 - this.x;
|
||||
this.height = y2 - this.y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Enlarges this rectangle to include the passed rectangle.
|
||||
* @param rectangle - The rectangle to include.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
enlarge(rectangle) {
|
||||
const x1 = Math.min(this.x, rectangle.x);
|
||||
const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
||||
const y1 = Math.min(this.y, rectangle.y);
|
||||
const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
||||
this.x = x1;
|
||||
this.width = x2 - x1;
|
||||
this.y = y1;
|
||||
this.height = y2 - y1;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
out.copyFrom(this);
|
||||
return out;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;
|
||||
}
|
||||
}
|
||||
|
||||
export { Rectangle };
|
||||
//# sourceMappingURL=Rectangle.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
87
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.d.ts
generated
vendored
Normal file
87
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import { Rectangle } from './Rectangle';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
/**
|
||||
* The `RoundedRectangle` object is an area defined by its position, as indicated by its top-left corner
|
||||
* point (`x`, `y`) and by its `width` and its `height`, including a `radius` property that
|
||||
* defines the radius of the rounded corners.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class RoundedRectangle implements ShapePrimitive {
|
||||
/**
|
||||
* The X coordinate of the upper-left corner of the rounded rectangle
|
||||
* @default 0
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* The Y coordinate of the upper-left corner of the rounded rectangle
|
||||
* @default 0
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The overall width of this rounded rectangle
|
||||
* @default 0
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* The overall height of this rounded rectangle
|
||||
* @default 0
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* Controls the radius of the rounded corners
|
||||
* @default 20
|
||||
*/
|
||||
radius: number;
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'roundedRectangle'
|
||||
*/
|
||||
readonly type = "roundedRectangle";
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param width - The overall width of this rounded rectangle
|
||||
* @param height - The overall height of this rounded rectangle
|
||||
* @param radius - Controls the radius of the rounded corners
|
||||
*/
|
||||
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
|
||||
/**
|
||||
* Returns the framing rectangle of the rounded rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
/**
|
||||
* Creates a clone of this Rounded Rectangle.
|
||||
* @returns - A copy of the rounded rectangle.
|
||||
*/
|
||||
clone(): RoundedRectangle;
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle: RoundedRectangle): this;
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle: RoundedRectangle): RoundedRectangle;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rounded Rectangle
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this Rounded Rectangle.
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param pX - The X coordinate of the point to test
|
||||
* @param pY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(pX: number, pY: number, strokeWidth: number): boolean;
|
||||
toString(): string;
|
||||
}
|
144
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.js
generated
vendored
Normal file
144
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
'use strict';
|
||||
|
||||
var Rectangle = require('./Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
const isCornerWithinStroke = (pX, pY, cornerX, cornerY, radius, halfStrokeWidth) => {
|
||||
const dx = pX - cornerX;
|
||||
const dy = pY - cornerY;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
return distance >= radius - halfStrokeWidth && distance <= radius + halfStrokeWidth;
|
||||
};
|
||||
class RoundedRectangle {
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param width - The overall width of this rounded rectangle
|
||||
* @param height - The overall height of this rounded rectangle
|
||||
* @param radius - Controls the radius of the rounded corners
|
||||
*/
|
||||
constructor(x = 0, y = 0, width = 0, height = 0, radius = 20) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'roundedRectangle'
|
||||
*/
|
||||
this.type = "roundedRectangle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.radius = radius;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the rounded rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle.Rectangle();
|
||||
out.x = this.x;
|
||||
out.y = this.y;
|
||||
out.width = this.width;
|
||||
out.height = this.height;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Rounded Rectangle.
|
||||
* @returns - A copy of the rounded rectangle.
|
||||
*/
|
||||
clone() {
|
||||
return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
|
||||
}
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle) {
|
||||
this.x = rectangle.x;
|
||||
this.y = rectangle.y;
|
||||
this.width = rectangle.width;
|
||||
this.height = rectangle.height;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle) {
|
||||
rectangle.copyFrom(this);
|
||||
return rectangle;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rounded Rectangle
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this Rounded Rectangle.
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.width <= 0 || this.height <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= this.x && x <= this.x + this.width) {
|
||||
if (y >= this.y && y <= this.y + this.height) {
|
||||
const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));
|
||||
if (y >= this.y + radius && y <= this.y + this.height - radius || x >= this.x + radius && x <= this.x + this.width - radius) {
|
||||
return true;
|
||||
}
|
||||
let dx = x - (this.x + radius);
|
||||
let dy = y - (this.y + radius);
|
||||
const radius2 = radius * radius;
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dx = x - (this.x + this.width - radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dy = y - (this.y + this.height - radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dx = x - (this.x + radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param pX - The X coordinate of the point to test
|
||||
* @param pY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(pX, pY, strokeWidth) {
|
||||
const { x, y, width, height, radius } = this;
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const innerX = x + radius;
|
||||
const innerY = y + radius;
|
||||
const innerWidth = width - radius * 2;
|
||||
const innerHeight = height - radius * 2;
|
||||
const rightBound = x + width;
|
||||
const bottomBound = y + height;
|
||||
if ((pX >= x - halfStrokeWidth && pX <= x + halfStrokeWidth || pX >= rightBound - halfStrokeWidth && pX <= rightBound + halfStrokeWidth) && pY >= innerY && pY <= innerY + innerHeight) {
|
||||
return true;
|
||||
}
|
||||
if ((pY >= y - halfStrokeWidth && pY <= y + halfStrokeWidth || pY >= bottomBound - halfStrokeWidth && pY <= bottomBound + halfStrokeWidth) && pX >= innerX && pX <= innerX + innerWidth) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
// Top-left
|
||||
pX < innerX && pY < innerY && isCornerWithinStroke(pX, pY, innerX, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY < innerY && isCornerWithinStroke(pX, pY, rightBound - radius, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, rightBound - radius, bottomBound - radius, radius, halfStrokeWidth) || pX < innerX && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, innerX, bottomBound - radius, radius, halfStrokeWidth)
|
||||
);
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`;
|
||||
}
|
||||
}
|
||||
|
||||
exports.RoundedRectangle = RoundedRectangle;
|
||||
//# sourceMappingURL=RoundedRectangle.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
142
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs
generated
vendored
Normal file
142
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
import { Rectangle } from './Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
const isCornerWithinStroke = (pX, pY, cornerX, cornerY, radius, halfStrokeWidth) => {
|
||||
const dx = pX - cornerX;
|
||||
const dy = pY - cornerY;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
return distance >= radius - halfStrokeWidth && distance <= radius + halfStrokeWidth;
|
||||
};
|
||||
class RoundedRectangle {
|
||||
/**
|
||||
* @param x - The X coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param y - The Y coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param width - The overall width of this rounded rectangle
|
||||
* @param height - The overall height of this rounded rectangle
|
||||
* @param radius - Controls the radius of the rounded corners
|
||||
*/
|
||||
constructor(x = 0, y = 0, width = 0, height = 0, radius = 20) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'roundedRectangle'
|
||||
*/
|
||||
this.type = "roundedRectangle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.radius = radius;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the rounded rectangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
out.x = this.x;
|
||||
out.y = this.y;
|
||||
out.width = this.width;
|
||||
out.height = this.height;
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Rounded Rectangle.
|
||||
* @returns - A copy of the rounded rectangle.
|
||||
*/
|
||||
clone() {
|
||||
return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
|
||||
}
|
||||
/**
|
||||
* Copies another rectangle to this one.
|
||||
* @param rectangle - The rectangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(rectangle) {
|
||||
this.x = rectangle.x;
|
||||
this.y = rectangle.y;
|
||||
this.width = rectangle.width;
|
||||
this.height = rectangle.height;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this rectangle to another one.
|
||||
* @param rectangle - The rectangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(rectangle) {
|
||||
rectangle.copyFrom(this);
|
||||
return rectangle;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this Rounded Rectangle
|
||||
* @param x - The X coordinate of the point to test.
|
||||
* @param y - The Y coordinate of the point to test.
|
||||
* @returns - Whether the x/y coordinates are within this Rounded Rectangle.
|
||||
*/
|
||||
contains(x, y) {
|
||||
if (this.width <= 0 || this.height <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= this.x && x <= this.x + this.width) {
|
||||
if (y >= this.y && y <= this.y + this.height) {
|
||||
const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));
|
||||
if (y >= this.y + radius && y <= this.y + this.height - radius || x >= this.x + radius && x <= this.x + this.width - radius) {
|
||||
return true;
|
||||
}
|
||||
let dx = x - (this.x + radius);
|
||||
let dy = y - (this.y + radius);
|
||||
const radius2 = radius * radius;
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dx = x - (this.x + this.width - radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dy = y - (this.y + this.height - radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
dx = x - (this.x + radius);
|
||||
if (dx * dx + dy * dy <= radius2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
||||
* @param pX - The X coordinate of the point to test
|
||||
* @param pY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this rectangle
|
||||
*/
|
||||
strokeContains(pX, pY, strokeWidth) {
|
||||
const { x, y, width, height, radius } = this;
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const innerX = x + radius;
|
||||
const innerY = y + radius;
|
||||
const innerWidth = width - radius * 2;
|
||||
const innerHeight = height - radius * 2;
|
||||
const rightBound = x + width;
|
||||
const bottomBound = y + height;
|
||||
if ((pX >= x - halfStrokeWidth && pX <= x + halfStrokeWidth || pX >= rightBound - halfStrokeWidth && pX <= rightBound + halfStrokeWidth) && pY >= innerY && pY <= innerY + innerHeight) {
|
||||
return true;
|
||||
}
|
||||
if ((pY >= y - halfStrokeWidth && pY <= y + halfStrokeWidth || pY >= bottomBound - halfStrokeWidth && pY <= bottomBound + halfStrokeWidth) && pX >= innerX && pX <= innerX + innerWidth) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
// Top-left
|
||||
pX < innerX && pY < innerY && isCornerWithinStroke(pX, pY, innerX, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY < innerY && isCornerWithinStroke(pX, pY, rightBound - radius, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, rightBound - radius, bottomBound - radius, radius, halfStrokeWidth) || pX < innerX && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, innerX, bottomBound - radius, radius, halfStrokeWidth)
|
||||
);
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`;
|
||||
}
|
||||
}
|
||||
|
||||
export { RoundedRectangle };
|
||||
//# sourceMappingURL=RoundedRectangle.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.d.ts
generated
vendored
Normal file
26
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { SHAPE_PRIMITIVE } from '../misc/const';
|
||||
import type { Rectangle } from './Rectangle';
|
||||
/**
|
||||
* A basic object to define a Pixi shape.
|
||||
* @memberof maths
|
||||
*/
|
||||
export interface ShapePrimitive {
|
||||
/** The type of the object, mainly used to avoid `instanceof` checks */
|
||||
readonly type: SHAPE_PRIMITIVE;
|
||||
/** Checks whether the x and y coordinates passed to this function are contained within this ShapePrimitive. */
|
||||
contains(x: number, y: number): boolean;
|
||||
/** Checks whether the x and y coordinates passed to this function are contained within the stroke of this shape */
|
||||
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
||||
/** Creates a clone of this ShapePrimitive instance. */
|
||||
clone(): ShapePrimitive;
|
||||
/** Copies the properties from another ShapePrimitive to this ShapePrimitive. */
|
||||
copyFrom(source: ShapePrimitive): void;
|
||||
/** Copies the properties from this ShapePrimitive to another ShapePrimitive. */
|
||||
copyTo(destination: ShapePrimitive): void;
|
||||
/** Returns the framing rectangle of the ShapePrimitive as a Rectangle object. */
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
/** The X coordinate of the shape */
|
||||
readonly x: number;
|
||||
/** The Y coordinate of the shape */
|
||||
readonly y: number;
|
||||
}
|
4
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=ShapePrimitive.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShapePrimitive.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=ShapePrimitive.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/ShapePrimitive.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShapePrimitive.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
99
node_modules/pixi.js/lib/maths/shapes/Triangle.d.ts
generated
vendored
Normal file
99
node_modules/pixi.js/lib/maths/shapes/Triangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { Rectangle } from './Rectangle';
|
||||
import type { SHAPE_PRIMITIVE } from '../misc/const';
|
||||
import type { ShapePrimitive } from './ShapePrimitive';
|
||||
/**
|
||||
* A class to define a shape of a triangle via user defined coordinates.
|
||||
*
|
||||
* Create a `Triangle` object with the `x`, `y`, `x2`, `y2`, `x3`, `y3` properties.
|
||||
*
|
||||
* ```js
|
||||
* import { Triangle } from 'pixi.js';
|
||||
*
|
||||
* const triangle = new Triangle(0, 0, 100, 0, 50, 50);
|
||||
* ```
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare class Triangle implements ShapePrimitive {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'triangle'
|
||||
*/
|
||||
readonly type: SHAPE_PRIMITIVE;
|
||||
/**
|
||||
* The X coord of the first point.
|
||||
* @default 0
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* The Y coord of the first point.
|
||||
* @default 0
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The X coord of the second point.
|
||||
* @default 0
|
||||
*/
|
||||
x2: number;
|
||||
/**
|
||||
* The Y coord of the second point.
|
||||
* @default 0
|
||||
*/
|
||||
y2: number;
|
||||
/**
|
||||
* The X coord of the third point.
|
||||
* @default 0
|
||||
*/
|
||||
x3: number;
|
||||
/**
|
||||
* The Y coord of the third point.
|
||||
* @default 0
|
||||
*/
|
||||
y3: number;
|
||||
/**
|
||||
* @param x - The X coord of the first point.
|
||||
* @param y - The Y coord of the first point.
|
||||
* @param x2 - The X coord of the second point.
|
||||
* @param y2 - The Y coord of the second point.
|
||||
* @param x3 - The X coord of the third point.
|
||||
* @param y3 - The Y coord of the third point.
|
||||
*/
|
||||
constructor(x?: number, y?: number, x2?: number, y2?: number, x3?: number, y3?: number);
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Triangle
|
||||
*/
|
||||
contains(x: number, y: number): boolean;
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle including the stroke.
|
||||
* @param pointX - The X coordinate of the point to test
|
||||
* @param pointY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this triangle
|
||||
*/
|
||||
strokeContains(pointX: number, pointY: number, strokeWidth: number): boolean;
|
||||
/**
|
||||
* Creates a clone of this Triangle
|
||||
* @returns a copy of the triangle
|
||||
*/
|
||||
clone(): ShapePrimitive;
|
||||
/**
|
||||
* Copies another triangle to this one.
|
||||
* @param triangle - The triangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(triangle: Triangle): this;
|
||||
/**
|
||||
* Copies this triangle to another one.
|
||||
* @param triangle - The triangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(triangle: Triangle): Triangle;
|
||||
/**
|
||||
* Returns the framing rectangle of the triangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out?: Rectangle): Rectangle;
|
||||
}
|
118
node_modules/pixi.js/lib/maths/shapes/Triangle.js
generated
vendored
Normal file
118
node_modules/pixi.js/lib/maths/shapes/Triangle.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
'use strict';
|
||||
|
||||
var squaredDistanceToLineSegment = require('../misc/squaredDistanceToLineSegment.js');
|
||||
var Rectangle = require('./Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
class Triangle {
|
||||
/**
|
||||
* @param x - The X coord of the first point.
|
||||
* @param y - The Y coord of the first point.
|
||||
* @param x2 - The X coord of the second point.
|
||||
* @param y2 - The Y coord of the second point.
|
||||
* @param x3 - The X coord of the third point.
|
||||
* @param y3 - The Y coord of the third point.
|
||||
*/
|
||||
constructor(x = 0, y = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'triangle'
|
||||
*/
|
||||
this.type = "triangle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.x3 = x3;
|
||||
this.y3 = y3;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Triangle
|
||||
*/
|
||||
contains(x, y) {
|
||||
const s = (this.x - this.x3) * (y - this.y3) - (this.y - this.y3) * (x - this.x3);
|
||||
const t = (this.x2 - this.x) * (y - this.y) - (this.y2 - this.y) * (x - this.x);
|
||||
if (s < 0 !== t < 0 && s !== 0 && t !== 0) {
|
||||
return false;
|
||||
}
|
||||
const d = (this.x3 - this.x2) * (y - this.y2) - (this.y3 - this.y2) * (x - this.x2);
|
||||
return d === 0 || d < 0 === s + t <= 0;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle including the stroke.
|
||||
* @param pointX - The X coordinate of the point to test
|
||||
* @param pointY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this triangle
|
||||
*/
|
||||
strokeContains(pointX, pointY, strokeWidth) {
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const halfStrokeWidthSquared = halfStrokeWidth * halfStrokeWidth;
|
||||
const { x, x2, x3, y, y2, y3 } = this;
|
||||
if (squaredDistanceToLineSegment.squaredDistanceToLineSegment(pointX, pointY, x, y, x2, y3) <= halfStrokeWidthSquared || squaredDistanceToLineSegment.squaredDistanceToLineSegment(pointX, pointY, x2, y2, x3, y3) <= halfStrokeWidthSquared || squaredDistanceToLineSegment.squaredDistanceToLineSegment(pointX, pointY, x3, y3, x, y) <= halfStrokeWidthSquared) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Triangle
|
||||
* @returns a copy of the triangle
|
||||
*/
|
||||
clone() {
|
||||
const triangle = new Triangle(
|
||||
this.x,
|
||||
this.y,
|
||||
this.x2,
|
||||
this.y2,
|
||||
this.x3,
|
||||
this.y3
|
||||
);
|
||||
return triangle;
|
||||
}
|
||||
/**
|
||||
* Copies another triangle to this one.
|
||||
* @param triangle - The triangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(triangle) {
|
||||
this.x = triangle.x;
|
||||
this.y = triangle.y;
|
||||
this.x2 = triangle.x2;
|
||||
this.y2 = triangle.y2;
|
||||
this.x3 = triangle.x3;
|
||||
this.y3 = triangle.y3;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this triangle to another one.
|
||||
* @param triangle - The triangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(triangle) {
|
||||
triangle.copyFrom(this);
|
||||
return triangle;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the triangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle.Rectangle();
|
||||
const minX = Math.min(this.x, this.x2, this.x3);
|
||||
const maxX = Math.max(this.x, this.x2, this.x3);
|
||||
const minY = Math.min(this.y, this.y2, this.y3);
|
||||
const maxY = Math.max(this.y, this.y2, this.y3);
|
||||
out.x = minX;
|
||||
out.y = minY;
|
||||
out.width = maxX - minX;
|
||||
out.height = maxY - minY;
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Triangle = Triangle;
|
||||
//# sourceMappingURL=Triangle.js.map
|
1
node_modules/pixi.js/lib/maths/shapes/Triangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Triangle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
116
node_modules/pixi.js/lib/maths/shapes/Triangle.mjs
generated
vendored
Normal file
116
node_modules/pixi.js/lib/maths/shapes/Triangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import { squaredDistanceToLineSegment } from '../misc/squaredDistanceToLineSegment.mjs';
|
||||
import { Rectangle } from './Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
class Triangle {
|
||||
/**
|
||||
* @param x - The X coord of the first point.
|
||||
* @param y - The Y coord of the first point.
|
||||
* @param x2 - The X coord of the second point.
|
||||
* @param y2 - The Y coord of the second point.
|
||||
* @param x3 - The X coord of the third point.
|
||||
* @param y3 - The Y coord of the third point.
|
||||
*/
|
||||
constructor(x = 0, y = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0) {
|
||||
/**
|
||||
* The type of the object, mainly used to avoid `instanceof` checks
|
||||
* @default 'triangle'
|
||||
*/
|
||||
this.type = "triangle";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.x3 = x3;
|
||||
this.y3 = y3;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle
|
||||
* @param x - The X coordinate of the point to test
|
||||
* @param y - The Y coordinate of the point to test
|
||||
* @returns Whether the x/y coordinates are within this Triangle
|
||||
*/
|
||||
contains(x, y) {
|
||||
const s = (this.x - this.x3) * (y - this.y3) - (this.y - this.y3) * (x - this.x3);
|
||||
const t = (this.x2 - this.x) * (y - this.y) - (this.y2 - this.y) * (x - this.x);
|
||||
if (s < 0 !== t < 0 && s !== 0 && t !== 0) {
|
||||
return false;
|
||||
}
|
||||
const d = (this.x3 - this.x2) * (y - this.y2) - (this.y3 - this.y2) * (x - this.x2);
|
||||
return d === 0 || d < 0 === s + t <= 0;
|
||||
}
|
||||
/**
|
||||
* Checks whether the x and y coordinates given are contained within this triangle including the stroke.
|
||||
* @param pointX - The X coordinate of the point to test
|
||||
* @param pointY - The Y coordinate of the point to test
|
||||
* @param strokeWidth - The width of the line to check
|
||||
* @returns Whether the x/y coordinates are within this triangle
|
||||
*/
|
||||
strokeContains(pointX, pointY, strokeWidth) {
|
||||
const halfStrokeWidth = strokeWidth / 2;
|
||||
const halfStrokeWidthSquared = halfStrokeWidth * halfStrokeWidth;
|
||||
const { x, x2, x3, y, y2, y3 } = this;
|
||||
if (squaredDistanceToLineSegment(pointX, pointY, x, y, x2, y3) <= halfStrokeWidthSquared || squaredDistanceToLineSegment(pointX, pointY, x2, y2, x3, y3) <= halfStrokeWidthSquared || squaredDistanceToLineSegment(pointX, pointY, x3, y3, x, y) <= halfStrokeWidthSquared) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Creates a clone of this Triangle
|
||||
* @returns a copy of the triangle
|
||||
*/
|
||||
clone() {
|
||||
const triangle = new Triangle(
|
||||
this.x,
|
||||
this.y,
|
||||
this.x2,
|
||||
this.y2,
|
||||
this.x3,
|
||||
this.y3
|
||||
);
|
||||
return triangle;
|
||||
}
|
||||
/**
|
||||
* Copies another triangle to this one.
|
||||
* @param triangle - The triangle to copy from.
|
||||
* @returns Returns itself.
|
||||
*/
|
||||
copyFrom(triangle) {
|
||||
this.x = triangle.x;
|
||||
this.y = triangle.y;
|
||||
this.x2 = triangle.x2;
|
||||
this.y2 = triangle.y2;
|
||||
this.x3 = triangle.x3;
|
||||
this.y3 = triangle.y3;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Copies this triangle to another one.
|
||||
* @param triangle - The triangle to copy to.
|
||||
* @returns Returns given parameter.
|
||||
*/
|
||||
copyTo(triangle) {
|
||||
triangle.copyFrom(this);
|
||||
return triangle;
|
||||
}
|
||||
/**
|
||||
* Returns the framing rectangle of the triangle as a Rectangle object
|
||||
* @param out - optional rectangle to store the result
|
||||
* @returns The framing rectangle
|
||||
*/
|
||||
getBounds(out) {
|
||||
out = out || new Rectangle();
|
||||
const minX = Math.min(this.x, this.x2, this.x3);
|
||||
const maxX = Math.max(this.x, this.x2, this.x3);
|
||||
const minY = Math.min(this.y, this.y2, this.y3);
|
||||
const maxY = Math.max(this.y, this.y2, this.y3);
|
||||
out.x = minX;
|
||||
out.y = minY;
|
||||
out.width = maxX - minX;
|
||||
out.height = maxY - minY;
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
export { Triangle };
|
||||
//# sourceMappingURL=Triangle.mjs.map
|
1
node_modules/pixi.js/lib/maths/shapes/Triangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/maths/shapes/Triangle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user