sdfsdfs
This commit is contained in:
66
node_modules/pixi.js/lib/math-extras/MathExtraMixins.d.ts
generated
vendored
Normal file
66
node_modules/pixi.js/lib/math-extras/MathExtraMixins.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/* eslint-disable max-len */
|
||||
declare global
|
||||
{
|
||||
namespace PixiMixins
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface Point extends Vector2Math
|
||||
{
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface ObservablePoint extends Vector2Math
|
||||
{
|
||||
}
|
||||
|
||||
interface Rectangle
|
||||
{
|
||||
containsRect(other: import('../maths/shapes/Rectangle').Rectangle): boolean;
|
||||
|
||||
equals(other: import('../maths/shapes/Rectangle').Rectangle): boolean;
|
||||
|
||||
intersection(other: import('../maths/shapes/Rectangle').Rectangle): import('../maths/shapes/Rectangle').Rectangle;
|
||||
intersection<T extends import('../maths/shapes/Rectangle').Rectangle>(other: import('../maths/shapes/Rectangle').Rectangle, outRect: T): T;
|
||||
|
||||
union(other: import('../maths/shapes/Rectangle').Rectangle): import('../maths/shapes/Rectangle').Rectangle;
|
||||
union<T extends import('../maths/shapes/Rectangle').Rectangle>(other: import('../maths/shapes/Rectangle').Rectangle, outRect: T): T;
|
||||
}
|
||||
}
|
||||
|
||||
interface Vector2Math
|
||||
{
|
||||
add(other: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
add<T extends import('../maths/point/PointData').PointData>(other: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
|
||||
subtract(other: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
subtract<T extends import('../maths/point/PointData').PointData>(other: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
|
||||
multiply(other: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
multiply<T extends import('../maths/point/PointData').PointData>(other: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
|
||||
// divide(other: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
// divide<T extends import('../maths/point/PointData').PointData>(other: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
|
||||
multiplyScalar(scalar: number): import('../maths/point/Point').Point;
|
||||
multiplyScalar<T extends import('../maths/point/PointData').PointData>(scalar: number, outPoint: T): T;
|
||||
|
||||
dot(other: import('../maths/point/PointData').PointData): number;
|
||||
|
||||
cross(other: import('../maths/point/PointData').PointData): number;
|
||||
|
||||
normalize(): import('../maths/point/Point').Point;
|
||||
normalize<T extends import('../maths/point/PointData').PointData>(outPoint: T): T;
|
||||
|
||||
magnitude(): number;
|
||||
|
||||
magnitudeSquared(): number;
|
||||
|
||||
project(onto: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
project<T extends import('../maths/point/PointData').PointData>(onto: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
|
||||
reflect(normal: import('../maths/point/PointData').PointData): import('../maths/point/Point').Point;
|
||||
reflect<T extends import('../maths/point/PointData').PointData>(normal: import('../maths/point/PointData').PointData, outPoint: T): T;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
3
node_modules/pixi.js/lib/math-extras/index.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/math-extras/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './pointExtras';
|
||||
export * from './rectangleExtras';
|
||||
export * from './util';
|
1
node_modules/pixi.js/lib/math-extras/init.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/init.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
13
node_modules/pixi.js/lib/math-extras/init.js
generated
vendored
Normal file
13
node_modules/pixi.js/lib/math-extras/init.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var ObservablePoint = require('../maths/point/ObservablePoint.js');
|
||||
var Point = require('../maths/point/Point.js');
|
||||
var Rectangle = require('../maths/shapes/Rectangle.js');
|
||||
var pointExtras = require('./pointExtras.js');
|
||||
var rectangleExtras = require('./rectangleExtras.js');
|
||||
|
||||
"use strict";
|
||||
Object.assign(Point.Point.prototype, pointExtras.pointExtraMixins);
|
||||
Object.assign(ObservablePoint.ObservablePoint.prototype, pointExtras.pointExtraMixins);
|
||||
Object.assign(Rectangle.Rectangle.prototype, rectangleExtras.rectangleExtraMixins);
|
||||
//# sourceMappingURL=init.js.map
|
1
node_modules/pixi.js/lib/math-extras/init.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/init.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.js","sources":["../../src/math-extras/init.ts"],"sourcesContent":["import { ObservablePoint } from '../maths/point/ObservablePoint';\nimport { Point } from '../maths/point/Point';\nimport { Rectangle } from '../maths/shapes/Rectangle';\nimport { pointExtraMixins } from './pointExtras';\nimport { rectangleExtraMixins } from './rectangleExtras';\n\nObject.assign(Point.prototype, pointExtraMixins);\nObject.assign(ObservablePoint.prototype, pointExtraMixins);\nObject.assign(Rectangle.prototype, rectangleExtraMixins);\n"],"names":["Point","pointExtraMixins","ObservablePoint","Rectangle","rectangleExtraMixins"],"mappings":";;;;;;;;;AAMA,MAAO,CAAA,MAAA,CAAOA,WAAM,CAAA,SAAA,EAAWC,4BAAgB,CAAA,CAAA;AAC/C,MAAO,CAAA,MAAA,CAAOC,+BAAgB,CAAA,SAAA,EAAWD,4BAAgB,CAAA,CAAA;AACzD,MAAO,CAAA,MAAA,CAAOE,mBAAU,CAAA,SAAA,EAAWC,oCAAoB,CAAA;;"}
|
11
node_modules/pixi.js/lib/math-extras/init.mjs
generated
vendored
Normal file
11
node_modules/pixi.js/lib/math-extras/init.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ObservablePoint } from '../maths/point/ObservablePoint.mjs';
|
||||
import { Point } from '../maths/point/Point.mjs';
|
||||
import { Rectangle } from '../maths/shapes/Rectangle.mjs';
|
||||
import { pointExtraMixins } from './pointExtras.mjs';
|
||||
import { rectangleExtraMixins } from './rectangleExtras.mjs';
|
||||
|
||||
"use strict";
|
||||
Object.assign(Point.prototype, pointExtraMixins);
|
||||
Object.assign(ObservablePoint.prototype, pointExtraMixins);
|
||||
Object.assign(Rectangle.prototype, rectangleExtraMixins);
|
||||
//# sourceMappingURL=init.mjs.map
|
1
node_modules/pixi.js/lib/math-extras/init.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/init.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.mjs","sources":["../../src/math-extras/init.ts"],"sourcesContent":["import { ObservablePoint } from '../maths/point/ObservablePoint';\nimport { Point } from '../maths/point/Point';\nimport { Rectangle } from '../maths/shapes/Rectangle';\nimport { pointExtraMixins } from './pointExtras';\nimport { rectangleExtraMixins } from './rectangleExtras';\n\nObject.assign(Point.prototype, pointExtraMixins);\nObject.assign(ObservablePoint.prototype, pointExtraMixins);\nObject.assign(Rectangle.prototype, rectangleExtraMixins);\n"],"names":[],"mappings":";;;;;;;AAMA,MAAO,CAAA,MAAA,CAAO,KAAM,CAAA,SAAA,EAAW,gBAAgB,CAAA,CAAA;AAC/C,MAAO,CAAA,MAAA,CAAO,eAAgB,CAAA,SAAA,EAAW,gBAAgB,CAAA,CAAA;AACzD,MAAO,CAAA,MAAA,CAAO,SAAU,CAAA,SAAA,EAAW,oBAAoB,CAAA"}
|
1
node_modules/pixi.js/lib/math-extras/pointExtras.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/pointExtras.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const pointExtraMixins: any;
|
349
node_modules/pixi.js/lib/math-extras/pointExtras.js
generated
vendored
Normal file
349
node_modules/pixi.js/lib/math-extras/pointExtras.js
generated
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
'use strict';
|
||||
|
||||
var Point = require('../maths/point/Point.js');
|
||||
|
||||
"use strict";
|
||||
const pointExtraMixins = {
|
||||
/**
|
||||
* Adds `other` to `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method add
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to add to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the addition.
|
||||
*/
|
||||
/**
|
||||
* Adds `other` to `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method add
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to add to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the addition.
|
||||
*/
|
||||
add(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
outPoint.x = this.x + other.x;
|
||||
outPoint.y = this.y + other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Subtracts `other` from `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method subtract
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to subtract to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the subtraction.
|
||||
*/
|
||||
/**
|
||||
* Subtracts `other` from `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method subtract
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to subtract to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the subtraction.
|
||||
*/
|
||||
subtract(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
outPoint.x = this.x - other.x;
|
||||
outPoint.y = this.y - other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Multiplies component-wise `other` and `this` points and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiply
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to multiply with `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the component-wise multiplication.
|
||||
*/
|
||||
/**
|
||||
* Multiplies component-wise `other` and `this` points and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiply
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to multiply with `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the component-wise multiplication.
|
||||
*/
|
||||
multiply(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
outPoint.x = this.x * other.x;
|
||||
outPoint.y = this.y * other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Multiplies each component of `this` point with the number `scalar` and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiplyScalar
|
||||
* @memberof maths.Point#
|
||||
* @param {number} scalar - The number to multiply both components of `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the multiplication.
|
||||
*/
|
||||
/**
|
||||
* Multiplies each component of `this` point with the number `scalar` and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiplyScalar
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {number} scalar - The number to multiply both components of `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the multiplication.
|
||||
*/
|
||||
multiplyScalar(scalar, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
outPoint.x = this.x * scalar;
|
||||
outPoint.y = this.y * scalar;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Computes the dot product of `other` with `this` point.
|
||||
* The dot product is the sum of the products of the corresponding components of two vectors.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method dot
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The other point to calculate the dot product with `this`.
|
||||
* @returns {number} The result of the dot product. This is an scalar value.
|
||||
*/
|
||||
/**
|
||||
* Computes the dot product of `other` with `this` point.
|
||||
* The dot product is the sum of the products of the corresponding components of two vectors.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method dot
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The other point to calculate the dot product with `this`.
|
||||
* @returns {number} The result of the dot product. This is an scalar value.
|
||||
*/
|
||||
dot(other) {
|
||||
return this.x * other.x + this.y * other.y;
|
||||
},
|
||||
/**
|
||||
* Computes the cross product of `other` with `this` point.
|
||||
* Given two linearly independent R3 vectors a and b, the cross product, a × b (read "a cross b"),
|
||||
* is a vector that is perpendicular to both a and b, and thus normal to the plane containing them.
|
||||
* While cross product only exists on 3D space, we can assume the z component of 2D to be zero and
|
||||
* the result becomes a vector that will only have magnitude on the z axis.
|
||||
*
|
||||
* This function returns the z component of the cross product of the two points.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method cross
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The other point to calculate the cross product with `this`.
|
||||
* @returns {number} The z component of the result of the cross product.
|
||||
*/
|
||||
/**
|
||||
* Computes the cross product of `other` with `this` point.
|
||||
* Given two linearly independent R3 vectors a and b, the cross product, a × b (read "a cross b"),
|
||||
* is a vector that is perpendicular to both a and b, and thus normal to the plane containing them.
|
||||
* While cross product only exists on 3D space, we can assume the z component of 2D to be zero and
|
||||
* the result becomes a vector that will only have magnitude on the z axis.
|
||||
*
|
||||
* This function returns the z component of the cross product of the two points.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method cross
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The other point to calculate the cross product with `this`.
|
||||
* @returns {number} The z component of the result of the cross product.
|
||||
*/
|
||||
cross(other) {
|
||||
return this.x * other.y - this.y * other.x;
|
||||
},
|
||||
/**
|
||||
* Computes a normalized version of `this` point.
|
||||
*
|
||||
* A normalized vector is a vector of magnitude (length) 1
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method normalize
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The normalized point.
|
||||
*/
|
||||
/**
|
||||
* Computes a normalized version of `this` point.
|
||||
*
|
||||
* A normalized vector is a vector of magnitude (length) 1
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method normalize
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The normalized point.
|
||||
*/
|
||||
normalize(outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
const magnitude = Math.sqrt(this.x * this.x + this.y * this.y);
|
||||
outPoint.x = this.x / magnitude;
|
||||
outPoint.y = this.y / magnitude;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Computes the magnitude of this point (Euclidean distance from 0, 0).
|
||||
*
|
||||
* Defined as the square root of the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitude
|
||||
* @memberof maths.Point#
|
||||
* @returns {number} The magnitude (length) of the vector.
|
||||
*/
|
||||
/**
|
||||
* Computes the magnitude of this point (Euclidean distance from 0, 0).
|
||||
*
|
||||
* Defined as the square root of the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitude
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @returns {number} The magnitude (length) of the vector.
|
||||
*/
|
||||
magnitude() {
|
||||
return Math.sqrt(this.x * this.x + this.y * this.y);
|
||||
},
|
||||
/**
|
||||
* Computes the square magnitude of this point.
|
||||
* If you are comparing the lengths of vectors, you should compare the length squared instead
|
||||
* as it is slightly more efficient to calculate.
|
||||
*
|
||||
* Defined as the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitudeSquared
|
||||
* @memberof maths.Point#
|
||||
* @returns {number} The magnitude squared (length squared) of the vector.
|
||||
*/
|
||||
/**
|
||||
* Computes the square magnitude of this point.
|
||||
* If you are comparing the lengths of vectors, you should compare the length squared instead
|
||||
* as it is slightly more efficient to calculate.
|
||||
*
|
||||
* Defined as the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitudeSquared
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @returns {number} The magnitude squared (length squared) of the vector.
|
||||
*/
|
||||
magnitudeSquared() {
|
||||
return this.x * this.x + this.y * this.y;
|
||||
},
|
||||
/**
|
||||
* Computes vector projection of `this` on `onto`.
|
||||
*
|
||||
* Imagine a light source, parallel to `onto`, above `this`.
|
||||
* The light would cast rays perpendicular to `onto`.
|
||||
* `this.project(onto)` is the shadow cast by `this` on the line defined by `onto` .
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method project
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} onto - A non zero vector describing a line on which to project `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `this` on `onto` projection.
|
||||
*/
|
||||
/**
|
||||
* Computes vector projection of `this` on `onto`.
|
||||
*
|
||||
* Imagine a light source, parallel to `onto`, above `this`.
|
||||
* The light would cast rays perpendicular to `onto`.
|
||||
* `this.project(onto)` is the shadow cast by `this` on the line defined by `onto` .
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method project
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} onto - A non zero vector describing a line on which to project `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `this` on `onto` projection.
|
||||
*/
|
||||
project(onto, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
const normalizedScalarProjection = (this.x * onto.x + this.y * onto.y) / (onto.x * onto.x + onto.y * onto.y);
|
||||
outPoint.x = onto.x * normalizedScalarProjection;
|
||||
outPoint.y = onto.y * normalizedScalarProjection;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Reflects `this` vector off of a plane orthogonal to `normal`.
|
||||
* `normal` is not normalized during this process. Consider normalizing your `normal` before use.
|
||||
*
|
||||
* Imagine a light source bouncing onto a mirror.
|
||||
* `this` vector is the light and `normal` is a vector perpendicular to the mirror.
|
||||
* `this.reflect(normal)` is the reflection of `this` on that mirror.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method reflect
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} normal - The normal vector of your reflecting plane.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The reflection of `this` on your reflecting plane.
|
||||
*/
|
||||
/**
|
||||
* Reflects `this` vector off of a plane orthogonal to `normal`.
|
||||
* `normal` is not normalized during this process. Consider normalizing your `normal` before use.
|
||||
*
|
||||
* Imagine a light source bouncing onto a mirror.
|
||||
* `this` vector is the light and `normal` is a vector perpendicular to the mirror.
|
||||
* `this.reflect(normal)` is the reflection of `this` on that mirror.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method reflect
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} normal - The normal vector of your reflecting plane.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The reflection of `this` on your reflecting plane.
|
||||
*/
|
||||
reflect(normal, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point.Point();
|
||||
}
|
||||
const dotProduct = this.x * normal.x + this.y * normal.y;
|
||||
outPoint.x = this.x - 2 * dotProduct * normal.x;
|
||||
outPoint.y = this.y - 2 * dotProduct * normal.y;
|
||||
return outPoint;
|
||||
}
|
||||
};
|
||||
|
||||
exports.pointExtraMixins = pointExtraMixins;
|
||||
//# sourceMappingURL=pointExtras.js.map
|
1
node_modules/pixi.js/lib/math-extras/pointExtras.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/pointExtras.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
347
node_modules/pixi.js/lib/math-extras/pointExtras.mjs
generated
vendored
Normal file
347
node_modules/pixi.js/lib/math-extras/pointExtras.mjs
generated
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
import { Point } from '../maths/point/Point.mjs';
|
||||
|
||||
"use strict";
|
||||
const pointExtraMixins = {
|
||||
/**
|
||||
* Adds `other` to `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method add
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to add to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the addition.
|
||||
*/
|
||||
/**
|
||||
* Adds `other` to `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method add
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to add to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the addition.
|
||||
*/
|
||||
add(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
outPoint.x = this.x + other.x;
|
||||
outPoint.y = this.y + other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Subtracts `other` from `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method subtract
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to subtract to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the subtraction.
|
||||
*/
|
||||
/**
|
||||
* Subtracts `other` from `this` point and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method subtract
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to subtract to `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the result of the subtraction.
|
||||
*/
|
||||
subtract(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
outPoint.x = this.x - other.x;
|
||||
outPoint.y = this.y - other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Multiplies component-wise `other` and `this` points and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiply
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The point to multiply with `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the component-wise multiplication.
|
||||
*/
|
||||
/**
|
||||
* Multiplies component-wise `other` and `this` points and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiply
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The point to multiply with `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the component-wise multiplication.
|
||||
*/
|
||||
multiply(other, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
outPoint.x = this.x * other.x;
|
||||
outPoint.y = this.y * other.y;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Multiplies each component of `this` point with the number `scalar` and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiplyScalar
|
||||
* @memberof maths.Point#
|
||||
* @param {number} scalar - The number to multiply both components of `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the multiplication.
|
||||
*/
|
||||
/**
|
||||
* Multiplies each component of `this` point with the number `scalar` and outputs into `outPoint` or a new Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method multiplyScalar
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {number} scalar - The number to multiply both components of `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `outPoint` reference or a new Point, with the multiplication.
|
||||
*/
|
||||
multiplyScalar(scalar, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
outPoint.x = this.x * scalar;
|
||||
outPoint.y = this.y * scalar;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Computes the dot product of `other` with `this` point.
|
||||
* The dot product is the sum of the products of the corresponding components of two vectors.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method dot
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The other point to calculate the dot product with `this`.
|
||||
* @returns {number} The result of the dot product. This is an scalar value.
|
||||
*/
|
||||
/**
|
||||
* Computes the dot product of `other` with `this` point.
|
||||
* The dot product is the sum of the products of the corresponding components of two vectors.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method dot
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The other point to calculate the dot product with `this`.
|
||||
* @returns {number} The result of the dot product. This is an scalar value.
|
||||
*/
|
||||
dot(other) {
|
||||
return this.x * other.x + this.y * other.y;
|
||||
},
|
||||
/**
|
||||
* Computes the cross product of `other` with `this` point.
|
||||
* Given two linearly independent R3 vectors a and b, the cross product, a × b (read "a cross b"),
|
||||
* is a vector that is perpendicular to both a and b, and thus normal to the plane containing them.
|
||||
* While cross product only exists on 3D space, we can assume the z component of 2D to be zero and
|
||||
* the result becomes a vector that will only have magnitude on the z axis.
|
||||
*
|
||||
* This function returns the z component of the cross product of the two points.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method cross
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} other - The other point to calculate the cross product with `this`.
|
||||
* @returns {number} The z component of the result of the cross product.
|
||||
*/
|
||||
/**
|
||||
* Computes the cross product of `other` with `this` point.
|
||||
* Given two linearly independent R3 vectors a and b, the cross product, a × b (read "a cross b"),
|
||||
* is a vector that is perpendicular to both a and b, and thus normal to the plane containing them.
|
||||
* While cross product only exists on 3D space, we can assume the z component of 2D to be zero and
|
||||
* the result becomes a vector that will only have magnitude on the z axis.
|
||||
*
|
||||
* This function returns the z component of the cross product of the two points.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method cross
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} other - The other point to calculate the cross product with `this`.
|
||||
* @returns {number} The z component of the result of the cross product.
|
||||
*/
|
||||
cross(other) {
|
||||
return this.x * other.y - this.y * other.x;
|
||||
},
|
||||
/**
|
||||
* Computes a normalized version of `this` point.
|
||||
*
|
||||
* A normalized vector is a vector of magnitude (length) 1
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method normalize
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The normalized point.
|
||||
*/
|
||||
/**
|
||||
* Computes a normalized version of `this` point.
|
||||
*
|
||||
* A normalized vector is a vector of magnitude (length) 1
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method normalize
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The normalized point.
|
||||
*/
|
||||
normalize(outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
const magnitude = Math.sqrt(this.x * this.x + this.y * this.y);
|
||||
outPoint.x = this.x / magnitude;
|
||||
outPoint.y = this.y / magnitude;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Computes the magnitude of this point (Euclidean distance from 0, 0).
|
||||
*
|
||||
* Defined as the square root of the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitude
|
||||
* @memberof maths.Point#
|
||||
* @returns {number} The magnitude (length) of the vector.
|
||||
*/
|
||||
/**
|
||||
* Computes the magnitude of this point (Euclidean distance from 0, 0).
|
||||
*
|
||||
* Defined as the square root of the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitude
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @returns {number} The magnitude (length) of the vector.
|
||||
*/
|
||||
magnitude() {
|
||||
return Math.sqrt(this.x * this.x + this.y * this.y);
|
||||
},
|
||||
/**
|
||||
* Computes the square magnitude of this point.
|
||||
* If you are comparing the lengths of vectors, you should compare the length squared instead
|
||||
* as it is slightly more efficient to calculate.
|
||||
*
|
||||
* Defined as the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitudeSquared
|
||||
* @memberof maths.Point#
|
||||
* @returns {number} The magnitude squared (length squared) of the vector.
|
||||
*/
|
||||
/**
|
||||
* Computes the square magnitude of this point.
|
||||
* If you are comparing the lengths of vectors, you should compare the length squared instead
|
||||
* as it is slightly more efficient to calculate.
|
||||
*
|
||||
* Defined as the sum of the squares of each component.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method magnitudeSquared
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @returns {number} The magnitude squared (length squared) of the vector.
|
||||
*/
|
||||
magnitudeSquared() {
|
||||
return this.x * this.x + this.y * this.y;
|
||||
},
|
||||
/**
|
||||
* Computes vector projection of `this` on `onto`.
|
||||
*
|
||||
* Imagine a light source, parallel to `onto`, above `this`.
|
||||
* The light would cast rays perpendicular to `onto`.
|
||||
* `this.project(onto)` is the shadow cast by `this` on the line defined by `onto` .
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method project
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} onto - A non zero vector describing a line on which to project `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `this` on `onto` projection.
|
||||
*/
|
||||
/**
|
||||
* Computes vector projection of `this` on `onto`.
|
||||
*
|
||||
* Imagine a light source, parallel to `onto`, above `this`.
|
||||
* The light would cast rays perpendicular to `onto`.
|
||||
* `this.project(onto)` is the shadow cast by `this` on the line defined by `onto` .
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method project
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} onto - A non zero vector describing a line on which to project `this`.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The `this` on `onto` projection.
|
||||
*/
|
||||
project(onto, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
const normalizedScalarProjection = (this.x * onto.x + this.y * onto.y) / (onto.x * onto.x + onto.y * onto.y);
|
||||
outPoint.x = onto.x * normalizedScalarProjection;
|
||||
outPoint.y = onto.y * normalizedScalarProjection;
|
||||
return outPoint;
|
||||
},
|
||||
/**
|
||||
* Reflects `this` vector off of a plane orthogonal to `normal`.
|
||||
* `normal` is not normalized during this process. Consider normalizing your `normal` before use.
|
||||
*
|
||||
* Imagine a light source bouncing onto a mirror.
|
||||
* `this` vector is the light and `normal` is a vector perpendicular to the mirror.
|
||||
* `this.reflect(normal)` is the reflection of `this` on that mirror.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method reflect
|
||||
* @memberof maths.Point#
|
||||
* @param {maths.PointData} normal - The normal vector of your reflecting plane.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The reflection of `this` on your reflecting plane.
|
||||
*/
|
||||
/**
|
||||
* Reflects `this` vector off of a plane orthogonal to `normal`.
|
||||
* `normal` is not normalized during this process. Consider normalizing your `normal` before use.
|
||||
*
|
||||
* Imagine a light source bouncing onto a mirror.
|
||||
* `this` vector is the light and `normal` is a vector perpendicular to the mirror.
|
||||
* `this.reflect(normal)` is the reflection of `this` on that mirror.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method reflect
|
||||
* @memberof maths.ObservablePoint#
|
||||
* @param {maths.PointData} normal - The normal vector of your reflecting plane.
|
||||
* @param {maths.PointData} [outPoint] - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The reflection of `this` on your reflecting plane.
|
||||
*/
|
||||
reflect(normal, outPoint) {
|
||||
if (!outPoint) {
|
||||
outPoint = new Point();
|
||||
}
|
||||
const dotProduct = this.x * normal.x + this.y * normal.y;
|
||||
outPoint.x = this.x - 2 * dotProduct * normal.x;
|
||||
outPoint.y = this.y - 2 * dotProduct * normal.y;
|
||||
return outPoint;
|
||||
}
|
||||
};
|
||||
|
||||
export { pointExtraMixins };
|
||||
//# sourceMappingURL=pointExtras.mjs.map
|
1
node_modules/pixi.js/lib/math-extras/pointExtras.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/pointExtras.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/pixi.js/lib/math-extras/rectangleExtras.d.ts
generated
vendored
Normal file
2
node_modules/pixi.js/lib/math-extras/rectangleExtras.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Rectangle } from '../maths/shapes/Rectangle';
|
||||
export declare const rectangleExtraMixins: Partial<Rectangle>;
|
106
node_modules/pixi.js/lib/math-extras/rectangleExtras.js
generated
vendored
Normal file
106
node_modules/pixi.js/lib/math-extras/rectangleExtras.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
'use strict';
|
||||
|
||||
var Rectangle = require('../maths/shapes/Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
const rectangleExtraMixins = {
|
||||
/**
|
||||
* Determines whether the `other` Rectangle is contained within `this` Rectangle object.
|
||||
* Rectangles that occupy the same space are considered to be containing each other.
|
||||
* Rectangles without area (width or height equal to zero) can't contain anything,
|
||||
* not even other arealess rectangles.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method containsRect
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to fit inside `this`.
|
||||
* @returns {boolean} A value of `true` if `this` Rectangle contains `other`; otherwise `false`.
|
||||
*/
|
||||
containsRect(other) {
|
||||
if (other.width <= 0 || other.height <= 0) {
|
||||
return other.x > this.x && other.y > this.y && other.right < this.right && other.bottom < this.bottom;
|
||||
}
|
||||
return other.x >= this.x && other.y >= this.y && other.right <= this.right && other.bottom <= this.bottom;
|
||||
},
|
||||
/**
|
||||
* Accepts `other` Rectangle and returns true if the given Rectangle is equal to `this` Rectangle.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method equals
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to compare with `this`
|
||||
* @returns {boolean} Returns true if all `x`, `y`, `width`, and `height` are equal.
|
||||
*/
|
||||
equals(other) {
|
||||
if (other === this) {
|
||||
return true;
|
||||
}
|
||||
return other && this.x === other.x && this.y === other.y && this.width === other.width && this.height === other.height;
|
||||
},
|
||||
/**
|
||||
* If the area of the intersection between the Rectangles `other` and `this` is not zero,
|
||||
* returns the area of intersection as a Rectangle object. Otherwise, return an empty Rectangle
|
||||
* with its properties set to zero.
|
||||
* Rectangles without area (width or height equal to zero) can't intersect or be intersected
|
||||
* and will always return an empty rectangle with its properties set to zero.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method intersection
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
||||
* @param {Rectangle} [outRect] - A Rectangle object in which to store the value,
|
||||
* optional (otherwise will create a new Rectangle).
|
||||
* @returns {Rectangle} The intersection of `this` and `other`.
|
||||
*/
|
||||
intersection(other, outRect) {
|
||||
if (!outRect) {
|
||||
outRect = new Rectangle.Rectangle();
|
||||
}
|
||||
const x0 = this.x < other.x ? other.x : this.x;
|
||||
const x1 = this.right > other.right ? other.right : this.right;
|
||||
if (x1 <= x0) {
|
||||
outRect.x = outRect.y = outRect.width = outRect.height = 0;
|
||||
return outRect;
|
||||
}
|
||||
const y0 = this.y < other.y ? other.y : this.y;
|
||||
const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
||||
if (y1 <= y0) {
|
||||
outRect.x = outRect.y = outRect.width = outRect.height = 0;
|
||||
return outRect;
|
||||
}
|
||||
outRect.x = x0;
|
||||
outRect.y = y0;
|
||||
outRect.width = x1 - x0;
|
||||
outRect.height = y1 - y0;
|
||||
return outRect;
|
||||
},
|
||||
/**
|
||||
* Adds `this` and `other` Rectangles together to create a new Rectangle object filling
|
||||
* the horizontal and vertical space between the two rectangles.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method union
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to unite with `this`.
|
||||
* @param {Rectangle} [outRect] - A Rectangle object in which to store the value,
|
||||
* optional (otherwise will create a new Rectangle).
|
||||
* @returns {Rectangle} The union of `this` and `other`.
|
||||
*/
|
||||
union(other, outRect) {
|
||||
if (!outRect) {
|
||||
outRect = new Rectangle.Rectangle();
|
||||
}
|
||||
const x1 = Math.min(this.x, other.x);
|
||||
const x2 = Math.max(this.x + this.width, other.x + other.width);
|
||||
const y1 = Math.min(this.y, other.y);
|
||||
const y2 = Math.max(this.y + this.height, other.y + other.height);
|
||||
outRect.x = x1;
|
||||
outRect.y = y1;
|
||||
outRect.width = x2 - x1;
|
||||
outRect.height = y2 - y1;
|
||||
return outRect;
|
||||
}
|
||||
};
|
||||
|
||||
exports.rectangleExtraMixins = rectangleExtraMixins;
|
||||
//# sourceMappingURL=rectangleExtras.js.map
|
1
node_modules/pixi.js/lib/math-extras/rectangleExtras.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/rectangleExtras.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
104
node_modules/pixi.js/lib/math-extras/rectangleExtras.mjs
generated
vendored
Normal file
104
node_modules/pixi.js/lib/math-extras/rectangleExtras.mjs
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
import { Rectangle } from '../maths/shapes/Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
const rectangleExtraMixins = {
|
||||
/**
|
||||
* Determines whether the `other` Rectangle is contained within `this` Rectangle object.
|
||||
* Rectangles that occupy the same space are considered to be containing each other.
|
||||
* Rectangles without area (width or height equal to zero) can't contain anything,
|
||||
* not even other arealess rectangles.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method containsRect
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to fit inside `this`.
|
||||
* @returns {boolean} A value of `true` if `this` Rectangle contains `other`; otherwise `false`.
|
||||
*/
|
||||
containsRect(other) {
|
||||
if (other.width <= 0 || other.height <= 0) {
|
||||
return other.x > this.x && other.y > this.y && other.right < this.right && other.bottom < this.bottom;
|
||||
}
|
||||
return other.x >= this.x && other.y >= this.y && other.right <= this.right && other.bottom <= this.bottom;
|
||||
},
|
||||
/**
|
||||
* Accepts `other` Rectangle and returns true if the given Rectangle is equal to `this` Rectangle.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method equals
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to compare with `this`
|
||||
* @returns {boolean} Returns true if all `x`, `y`, `width`, and `height` are equal.
|
||||
*/
|
||||
equals(other) {
|
||||
if (other === this) {
|
||||
return true;
|
||||
}
|
||||
return other && this.x === other.x && this.y === other.y && this.width === other.width && this.height === other.height;
|
||||
},
|
||||
/**
|
||||
* If the area of the intersection between the Rectangles `other` and `this` is not zero,
|
||||
* returns the area of intersection as a Rectangle object. Otherwise, return an empty Rectangle
|
||||
* with its properties set to zero.
|
||||
* Rectangles without area (width or height equal to zero) can't intersect or be intersected
|
||||
* and will always return an empty rectangle with its properties set to zero.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method intersection
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
||||
* @param {Rectangle} [outRect] - A Rectangle object in which to store the value,
|
||||
* optional (otherwise will create a new Rectangle).
|
||||
* @returns {Rectangle} The intersection of `this` and `other`.
|
||||
*/
|
||||
intersection(other, outRect) {
|
||||
if (!outRect) {
|
||||
outRect = new Rectangle();
|
||||
}
|
||||
const x0 = this.x < other.x ? other.x : this.x;
|
||||
const x1 = this.right > other.right ? other.right : this.right;
|
||||
if (x1 <= x0) {
|
||||
outRect.x = outRect.y = outRect.width = outRect.height = 0;
|
||||
return outRect;
|
||||
}
|
||||
const y0 = this.y < other.y ? other.y : this.y;
|
||||
const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
||||
if (y1 <= y0) {
|
||||
outRect.x = outRect.y = outRect.width = outRect.height = 0;
|
||||
return outRect;
|
||||
}
|
||||
outRect.x = x0;
|
||||
outRect.y = y0;
|
||||
outRect.width = x1 - x0;
|
||||
outRect.height = y1 - y0;
|
||||
return outRect;
|
||||
},
|
||||
/**
|
||||
* Adds `this` and `other` Rectangles together to create a new Rectangle object filling
|
||||
* the horizontal and vertical space between the two rectangles.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @method union
|
||||
* @memberof maths.Rectangle#
|
||||
* @param {Rectangle} other - The Rectangle to unite with `this`.
|
||||
* @param {Rectangle} [outRect] - A Rectangle object in which to store the value,
|
||||
* optional (otherwise will create a new Rectangle).
|
||||
* @returns {Rectangle} The union of `this` and `other`.
|
||||
*/
|
||||
union(other, outRect) {
|
||||
if (!outRect) {
|
||||
outRect = new Rectangle();
|
||||
}
|
||||
const x1 = Math.min(this.x, other.x);
|
||||
const x2 = Math.max(this.x + this.width, other.x + other.width);
|
||||
const y1 = Math.min(this.y, other.y);
|
||||
const y2 = Math.max(this.y + this.height, other.y + other.height);
|
||||
outRect.x = x1;
|
||||
outRect.y = y1;
|
||||
outRect.width = x2 - x1;
|
||||
outRect.height = y2 - y1;
|
||||
return outRect;
|
||||
}
|
||||
};
|
||||
|
||||
export { rectangleExtraMixins };
|
||||
//# sourceMappingURL=rectangleExtras.mjs.map
|
1
node_modules/pixi.js/lib/math-extras/rectangleExtras.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/math-extras/rectangleExtras.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
88
node_modules/pixi.js/lib/math-extras/util.d.ts
generated
vendored
Normal file
88
node_modules/pixi.js/lib/math-extras/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import { Point } from '../maths/point/Point';
|
||||
import './pointExtras';
|
||||
import './rectangleExtras';
|
||||
import type { PointData } from '../maths/point/PointData';
|
||||
/**
|
||||
* The idea of a relative epsilon comparison is to find the difference between the two numbers,
|
||||
* and see if it is less than `Math.EPSILON`.
|
||||
* @param {number} a - First floating number to compare.
|
||||
* @param {number} b - Second floating number to compare.
|
||||
* @returns {boolean} Returns `true` if the difference between the values is less than `Math.EPSILON`; otherwise `false`.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function floatEqual(a: number, b: number): boolean;
|
||||
/**
|
||||
* The idea of a relative epsilon comparison is to find the difference between the two numbers,
|
||||
* and see if it is less than a given epsilon.
|
||||
* A good epsilon would be the N% of the largest of the two values or `Math.EPSILON`.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @param {number} a - First floating number to compare.
|
||||
* @param {number} b - Second floating number to compare.
|
||||
* @param {number} epsilon - The epsilon to compare to.
|
||||
* The larger the epsilon, the easier for the numbers to be considered equals.
|
||||
* @returns {boolean} Returns `true` if the difference between the values is less than the given epsilon;
|
||||
* otherwise `false`.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function floatEqual(a: number, b: number, epsilon: number): boolean;
|
||||
/**
|
||||
* Computes the point where non-coincident and non-parallel Lines intersect.
|
||||
* Coincident or parallel lines return a `NaN` point `{x: NaN, y: NaN}`.
|
||||
* The intersection point may land outside the extents of the lines.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @param aStart - First point of the first line.
|
||||
* @param aEnd - Second point of the first line.
|
||||
* @param bStart - First point of the second line.
|
||||
* @param bEnd - Second point of the second line.
|
||||
* @returns {PointData} The point where the lines intersect.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function lineIntersection(aStart: PointData, aEnd: PointData, bStart: PointData, bEnd: PointData): Point;
|
||||
/**
|
||||
* Computes the point where non-coincident and non-parallel Lines intersect.
|
||||
* Coincident or parallel lines return a `NaN` point `{x: NaN, y: NaN}`.
|
||||
* The intersection point may land outside the extents of the lines.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @param aStart - First point of the first line.
|
||||
* @param aEnd - Second point of the first line.
|
||||
* @param bStart - First point of the second line.
|
||||
* @param bEnd - Second point of the second line.
|
||||
* @param {PointData} outPoint - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The point where the lines intersect or a `NaN` Point.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function lineIntersection<T extends PointData>(aStart: PointData, aEnd: PointData, bStart: PointData, bEnd: PointData, outPoint: T): T;
|
||||
/**
|
||||
* Computes the point where non-coincident and non-parallel segments intersect.
|
||||
* Coincident, parallel or non-intersecting segments return a `NaN` point `{x: NaN, y: NaN}`.
|
||||
* The intersection point must land inside the extents of the segments or return a `NaN` Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @param aStart - Starting point of the first segment.
|
||||
* @param aEnd - Ending point of the first segment.
|
||||
* @param bStart - Starting point of the second segment.
|
||||
* @param bEnd - Ending point of the second segment.
|
||||
* @returns {PointData} The point where the segments intersect.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function segmentIntersection(aStart: PointData, aEnd: PointData, bStart: PointData, bEnd: PointData): Point;
|
||||
/**
|
||||
* Computes the point where non-coincident and non-parallel segments intersect.
|
||||
* Coincident, parallel or non-intersecting segments return a `NaN` point `{x: NaN, y: NaN}`.
|
||||
* The intersection point must land inside the extents of the segments or return a `NaN` Point.
|
||||
*
|
||||
* _Note: Only available with **pixi.js/math-extras**._
|
||||
* @param aStart - Starting point of the first segment.
|
||||
* @param aEnd - Ending point of the first segment.
|
||||
* @param bStart - Starting point of the second segment.
|
||||
* @param bEnd - Ending point of the second segment.
|
||||
* @param {PointData} outPoint - A Point-like object in which to store the value,
|
||||
* optional (otherwise will create a new Point).
|
||||
* @returns {PointData} The point where the segments intersect or a `NaN` Point.
|
||||
* @memberof maths
|
||||
*/
|
||||
export declare function segmentIntersection<T extends PointData>(aStart: PointData, aEnd: PointData, bStart: PointData, bEnd: PointData, outPoint: T): T;
|
Reference in New Issue
Block a user