sdfsdfs
This commit is contained in:
7
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.d.ts
generated
vendored
Normal file
7
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { ExtensionMetadataDetails } from '../../../../extensions/Extensions';
|
||||
import type { ShapePrimitive } from '../../../../maths/shapes/ShapePrimitive';
|
||||
export interface ShapeBuildCommand<T extends ShapePrimitive = ShapePrimitive> {
|
||||
extension: ExtensionMetadataDetails;
|
||||
build(shape: T, points: number[]): void;
|
||||
triangulate(points: number[], vertices: number[], verticesStride: number, verticesOffset: number, indices: number[], indicesOffset: number): void;
|
||||
}
|
4
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=ShapeBuildCommand.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShapeBuildCommand.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=ShapeBuildCommand.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/ShapeBuildCommand.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShapeBuildCommand.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function buildAdaptiveBezier(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, eX: number, eY: number, smoothness?: number): number[];
|
136
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.js
generated
vendored
Normal file
136
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
var GraphicsContextSystem = require('../GraphicsContextSystem.js');
|
||||
|
||||
"use strict";
|
||||
const RECURSION_LIMIT = 8;
|
||||
const FLT_EPSILON = 11920929e-14;
|
||||
const PATH_DISTANCE_EPSILON = 1;
|
||||
const curveAngleToleranceEpsilon = 0.01;
|
||||
const mAngleTolerance = 0;
|
||||
const mCuspLimit = 0;
|
||||
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
|
||||
const scale = 1;
|
||||
const smoothing = Math.min(
|
||||
0.99,
|
||||
// a value of 1.0 actually inverts smoothing, so we cap it at 0.99
|
||||
Math.max(0, smoothness ?? GraphicsContextSystem.GraphicsContextSystem.defaultOptions.bezierSmoothness)
|
||||
);
|
||||
let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
|
||||
distanceTolerance *= distanceTolerance;
|
||||
begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
|
||||
return points;
|
||||
}
|
||||
function begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance) {
|
||||
recursive(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance, 0);
|
||||
points.push(eX, eY);
|
||||
}
|
||||
function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, level) {
|
||||
if (level > RECURSION_LIMIT) {
|
||||
return;
|
||||
}
|
||||
const pi = Math.PI;
|
||||
const x12 = (x1 + x2) / 2;
|
||||
const y12 = (y1 + y2) / 2;
|
||||
const x23 = (x2 + x3) / 2;
|
||||
const y23 = (y2 + y3) / 2;
|
||||
const x34 = (x3 + x4) / 2;
|
||||
const y34 = (y3 + y4) / 2;
|
||||
const x123 = (x12 + x23) / 2;
|
||||
const y123 = (y12 + y23) / 2;
|
||||
const x234 = (x23 + x34) / 2;
|
||||
const y234 = (y23 + y34) / 2;
|
||||
const x1234 = (x123 + x234) / 2;
|
||||
const y1234 = (y123 + y234) / 2;
|
||||
if (level > 0) {
|
||||
let dx = x4 - x1;
|
||||
let dy = y4 - y1;
|
||||
const d2 = Math.abs((x2 - x4) * dy - (y2 - y4) * dx);
|
||||
const d3 = Math.abs((x3 - x4) * dy - (y3 - y4) * dx);
|
||||
let da1;
|
||||
let da2;
|
||||
if (d2 > FLT_EPSILON && d3 > FLT_EPSILON) {
|
||||
if ((d2 + d3) * (d2 + d3) <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
const a23 = Math.atan2(y3 - y2, x3 - x2);
|
||||
da1 = Math.abs(a23 - Math.atan2(y2 - y1, x2 - x1));
|
||||
da2 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - a23);
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da2 >= pi)
|
||||
da2 = 2 * pi - da2;
|
||||
if (da1 + da2 < mAngleTolerance) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x2, y2);
|
||||
return;
|
||||
}
|
||||
if (da2 > mCuspLimit) {
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (d2 > FLT_EPSILON) {
|
||||
if (d2 * d2 <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
da1 = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da1 < mAngleTolerance) {
|
||||
points.push(x2, y2);
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x2, y2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (d3 > FLT_EPSILON) {
|
||||
if (d3 * d3 <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
da1 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - Math.atan2(y3 - y2, x3 - x2));
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da1 < mAngleTolerance) {
|
||||
points.push(x2, y2);
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dx = x1234 - (x1 + x4) / 2;
|
||||
dy = y1234 - (y1 + y4) / 2;
|
||||
if (dx * dx + dy * dy <= distanceTolerance) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
recursive(x1, y1, x12, y12, x123, y123, x1234, y1234, points, distanceTolerance, level + 1);
|
||||
recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
|
||||
}
|
||||
|
||||
exports.buildAdaptiveBezier = buildAdaptiveBezier;
|
||||
//# sourceMappingURL=buildAdaptiveBezier.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
134
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs
generated
vendored
Normal file
134
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import { GraphicsContextSystem } from '../GraphicsContextSystem.mjs';
|
||||
|
||||
"use strict";
|
||||
const RECURSION_LIMIT = 8;
|
||||
const FLT_EPSILON = 11920929e-14;
|
||||
const PATH_DISTANCE_EPSILON = 1;
|
||||
const curveAngleToleranceEpsilon = 0.01;
|
||||
const mAngleTolerance = 0;
|
||||
const mCuspLimit = 0;
|
||||
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
|
||||
const scale = 1;
|
||||
const smoothing = Math.min(
|
||||
0.99,
|
||||
// a value of 1.0 actually inverts smoothing, so we cap it at 0.99
|
||||
Math.max(0, smoothness ?? GraphicsContextSystem.defaultOptions.bezierSmoothness)
|
||||
);
|
||||
let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
|
||||
distanceTolerance *= distanceTolerance;
|
||||
begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
|
||||
return points;
|
||||
}
|
||||
function begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance) {
|
||||
recursive(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance, 0);
|
||||
points.push(eX, eY);
|
||||
}
|
||||
function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, level) {
|
||||
if (level > RECURSION_LIMIT) {
|
||||
return;
|
||||
}
|
||||
const pi = Math.PI;
|
||||
const x12 = (x1 + x2) / 2;
|
||||
const y12 = (y1 + y2) / 2;
|
||||
const x23 = (x2 + x3) / 2;
|
||||
const y23 = (y2 + y3) / 2;
|
||||
const x34 = (x3 + x4) / 2;
|
||||
const y34 = (y3 + y4) / 2;
|
||||
const x123 = (x12 + x23) / 2;
|
||||
const y123 = (y12 + y23) / 2;
|
||||
const x234 = (x23 + x34) / 2;
|
||||
const y234 = (y23 + y34) / 2;
|
||||
const x1234 = (x123 + x234) / 2;
|
||||
const y1234 = (y123 + y234) / 2;
|
||||
if (level > 0) {
|
||||
let dx = x4 - x1;
|
||||
let dy = y4 - y1;
|
||||
const d2 = Math.abs((x2 - x4) * dy - (y2 - y4) * dx);
|
||||
const d3 = Math.abs((x3 - x4) * dy - (y3 - y4) * dx);
|
||||
let da1;
|
||||
let da2;
|
||||
if (d2 > FLT_EPSILON && d3 > FLT_EPSILON) {
|
||||
if ((d2 + d3) * (d2 + d3) <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
const a23 = Math.atan2(y3 - y2, x3 - x2);
|
||||
da1 = Math.abs(a23 - Math.atan2(y2 - y1, x2 - x1));
|
||||
da2 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - a23);
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da2 >= pi)
|
||||
da2 = 2 * pi - da2;
|
||||
if (da1 + da2 < mAngleTolerance) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x2, y2);
|
||||
return;
|
||||
}
|
||||
if (da2 > mCuspLimit) {
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (d2 > FLT_EPSILON) {
|
||||
if (d2 * d2 <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
da1 = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da1 < mAngleTolerance) {
|
||||
points.push(x2, y2);
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x2, y2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (d3 > FLT_EPSILON) {
|
||||
if (d3 * d3 <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
da1 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - Math.atan2(y3 - y2, x3 - x2));
|
||||
if (da1 >= pi)
|
||||
da1 = 2 * pi - da1;
|
||||
if (da1 < mAngleTolerance) {
|
||||
points.push(x2, y2);
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
if (mCuspLimit !== 0) {
|
||||
if (da1 > mCuspLimit) {
|
||||
points.push(x3, y3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dx = x1234 - (x1 + x4) / 2;
|
||||
dy = y1234 - (y1 + y4) / 2;
|
||||
if (dx * dx + dy * dy <= distanceTolerance) {
|
||||
points.push(x1234, y1234);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
recursive(x1, y1, x12, y12, x123, y123, x1234, y1234, points, distanceTolerance, level + 1);
|
||||
recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
|
||||
}
|
||||
|
||||
export { buildAdaptiveBezier };
|
||||
//# sourceMappingURL=buildAdaptiveBezier.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function buildAdaptiveQuadratic(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, eX: number, eY: number, smoothness?: number): number[];
|
68
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.js
generated
vendored
Normal file
68
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
var GraphicsContextSystem = require('../GraphicsContextSystem.js');
|
||||
|
||||
"use strict";
|
||||
const RECURSION_LIMIT = 8;
|
||||
const FLT_EPSILON = 11920929e-14;
|
||||
const PATH_DISTANCE_EPSILON = 1;
|
||||
const curveAngleToleranceEpsilon = 0.01;
|
||||
const mAngleTolerance = 0;
|
||||
function buildAdaptiveQuadratic(points, sX, sY, cp1x, cp1y, eX, eY, smoothness) {
|
||||
const scale = 1;
|
||||
const smoothing = Math.min(
|
||||
0.99,
|
||||
// a value of 1.0 actually inverts smoothing, so we cap it at 0.99
|
||||
Math.max(0, smoothness ?? GraphicsContextSystem.GraphicsContextSystem.defaultOptions.bezierSmoothness)
|
||||
);
|
||||
let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
|
||||
distanceTolerance *= distanceTolerance;
|
||||
begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance);
|
||||
return points;
|
||||
}
|
||||
function begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance) {
|
||||
recursive(points, sX, sY, cp1x, cp1y, eX, eY, distanceTolerance, 0);
|
||||
points.push(eX, eY);
|
||||
}
|
||||
function recursive(points, x1, y1, x2, y2, x3, y3, distanceTolerance, level) {
|
||||
if (level > RECURSION_LIMIT) {
|
||||
return;
|
||||
}
|
||||
const pi = Math.PI;
|
||||
const x12 = (x1 + x2) / 2;
|
||||
const y12 = (y1 + y2) / 2;
|
||||
const x23 = (x2 + x3) / 2;
|
||||
const y23 = (y2 + y3) / 2;
|
||||
const x123 = (x12 + x23) / 2;
|
||||
const y123 = (y12 + y23) / 2;
|
||||
let dx = x3 - x1;
|
||||
let dy = y3 - y1;
|
||||
const d = Math.abs((x2 - x3) * dy - (y2 - y3) * dx);
|
||||
if (d > FLT_EPSILON) {
|
||||
if (d * d <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
let da = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));
|
||||
if (da >= pi)
|
||||
da = 2 * pi - da;
|
||||
if (da < mAngleTolerance) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dx = x123 - (x1 + x3) / 2;
|
||||
dy = y123 - (y1 + y3) / 2;
|
||||
if (dx * dx + dy * dy <= distanceTolerance) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
}
|
||||
recursive(points, x1, y1, x12, y12, x123, y123, distanceTolerance, level + 1);
|
||||
recursive(points, x123, y123, x23, y23, x3, y3, distanceTolerance, level + 1);
|
||||
}
|
||||
|
||||
exports.buildAdaptiveQuadratic = buildAdaptiveQuadratic;
|
||||
//# sourceMappingURL=buildAdaptiveQuadratic.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs
generated
vendored
Normal file
66
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { GraphicsContextSystem } from '../GraphicsContextSystem.mjs';
|
||||
|
||||
"use strict";
|
||||
const RECURSION_LIMIT = 8;
|
||||
const FLT_EPSILON = 11920929e-14;
|
||||
const PATH_DISTANCE_EPSILON = 1;
|
||||
const curveAngleToleranceEpsilon = 0.01;
|
||||
const mAngleTolerance = 0;
|
||||
function buildAdaptiveQuadratic(points, sX, sY, cp1x, cp1y, eX, eY, smoothness) {
|
||||
const scale = 1;
|
||||
const smoothing = Math.min(
|
||||
0.99,
|
||||
// a value of 1.0 actually inverts smoothing, so we cap it at 0.99
|
||||
Math.max(0, smoothness ?? GraphicsContextSystem.defaultOptions.bezierSmoothness)
|
||||
);
|
||||
let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
|
||||
distanceTolerance *= distanceTolerance;
|
||||
begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance);
|
||||
return points;
|
||||
}
|
||||
function begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance) {
|
||||
recursive(points, sX, sY, cp1x, cp1y, eX, eY, distanceTolerance, 0);
|
||||
points.push(eX, eY);
|
||||
}
|
||||
function recursive(points, x1, y1, x2, y2, x3, y3, distanceTolerance, level) {
|
||||
if (level > RECURSION_LIMIT) {
|
||||
return;
|
||||
}
|
||||
const pi = Math.PI;
|
||||
const x12 = (x1 + x2) / 2;
|
||||
const y12 = (y1 + y2) / 2;
|
||||
const x23 = (x2 + x3) / 2;
|
||||
const y23 = (y2 + y3) / 2;
|
||||
const x123 = (x12 + x23) / 2;
|
||||
const y123 = (y12 + y23) / 2;
|
||||
let dx = x3 - x1;
|
||||
let dy = y3 - y1;
|
||||
const d = Math.abs((x2 - x3) * dy - (y2 - y3) * dx);
|
||||
if (d > FLT_EPSILON) {
|
||||
if (d * d <= distanceTolerance * (dx * dx + dy * dy)) {
|
||||
if (mAngleTolerance < curveAngleToleranceEpsilon) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
let da = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));
|
||||
if (da >= pi)
|
||||
da = 2 * pi - da;
|
||||
if (da < mAngleTolerance) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dx = x123 - (x1 + x3) / 2;
|
||||
dy = y123 - (y1 + y3) / 2;
|
||||
if (dx * dx + dy * dy <= distanceTolerance) {
|
||||
points.push(x123, y123);
|
||||
return;
|
||||
}
|
||||
}
|
||||
recursive(points, x1, y1, x12, y12, x123, y123, distanceTolerance, level + 1);
|
||||
recursive(points, x123, y123, x23, y23, x3, y3, distanceTolerance, level + 1);
|
||||
}
|
||||
|
||||
export { buildAdaptiveQuadratic };
|
||||
//# sourceMappingURL=buildAdaptiveQuadratic.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function buildArc(points: number[], x: number, y: number, radius: number, start: number, end: number, clockwise: boolean, steps?: number): void;
|
27
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.js
generated
vendored
Normal file
27
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function buildArc(points, x, y, radius, start, end, clockwise, steps) {
|
||||
let dist = Math.abs(start - end);
|
||||
if (!clockwise && start > end) {
|
||||
dist = 2 * Math.PI - dist;
|
||||
} else if (clockwise && end > start) {
|
||||
dist = 2 * Math.PI - dist;
|
||||
}
|
||||
steps = steps || Math.max(6, Math.floor(6 * Math.pow(radius, 1 / 3) * (dist / Math.PI)));
|
||||
steps = Math.max(steps, 3);
|
||||
let f = dist / steps;
|
||||
let t = start;
|
||||
f *= clockwise ? -1 : 1;
|
||||
for (let i = 0; i < steps + 1; i++) {
|
||||
const cs = Math.cos(t);
|
||||
const sn = Math.sin(t);
|
||||
const nx = x + cs * radius;
|
||||
const ny = y + sn * radius;
|
||||
points.push(nx, ny);
|
||||
t += f;
|
||||
}
|
||||
}
|
||||
|
||||
exports.buildArc = buildArc;
|
||||
//# sourceMappingURL=buildArc.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildArc.js","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildArc.ts"],"sourcesContent":["export function buildArc(\n points: number[],\n x: number, y: number,\n radius: number,\n start: number,\n end: number,\n clockwise: boolean,\n steps?: number\n)\n{\n // determine distance between the two angles\n // ...probably a nicer way of writing this\n let dist = Math.abs(start - end);\n\n if (!clockwise && start > end)\n {\n dist = (2 * Math.PI) - dist;\n }\n else if (clockwise && end > start)\n {\n dist = (2 * Math.PI) - dist;\n }\n\n // approximate the # of steps using the cube root of the radius\n\n steps = steps || Math.max(6, Math.floor(6 * Math.pow(radius, 1 / 3) * (dist / (Math.PI))));\n\n // ensure we have at least 3 steps..\n steps = Math.max(steps, 3);\n\n let f = dist / (steps);\n let t = start;\n\n // modify direction\n f *= clockwise ? -1 : 1;\n\n for (let i = 0; i < steps + 1; i++)\n {\n const cs = Math.cos(t);\n const sn = Math.sin(t);\n\n const nx = x + (cs * radius);\n const ny = y + (sn * radius);\n\n points.push(nx, ny);\n\n t += f;\n }\n}\n"],"names":[],"mappings":";;;AAAgB,SAAA,QAAA,CACZ,QACA,CAAW,EAAA,CAAA,EACX,QACA,KACA,EAAA,GAAA,EACA,WACA,KAEJ,EAAA;AAGI,EAAA,IAAI,IAAO,GAAA,IAAA,CAAK,GAAI,CAAA,KAAA,GAAQ,GAAG,CAAA,CAAA;AAE/B,EAAI,IAAA,CAAC,SAAa,IAAA,KAAA,GAAQ,GAC1B,EAAA;AACI,IAAQ,IAAA,GAAA,CAAA,GAAI,KAAK,EAAM,GAAA,IAAA,CAAA;AAAA,GAC3B,MAAA,IACS,SAAa,IAAA,GAAA,GAAM,KAC5B,EAAA;AACI,IAAQ,IAAA,GAAA,CAAA,GAAI,KAAK,EAAM,GAAA,IAAA,CAAA;AAAA,GAC3B;AAIA,EAAA,KAAA,GAAQ,SAAS,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,CAAK,MAAM,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,MAAA,EAAQ,IAAI,CAAC,CAAA,IAAK,IAAQ,GAAA,IAAA,CAAK,GAAI,CAAC,CAAA,CAAA;AAGzF,EAAQ,KAAA,GAAA,IAAA,CAAK,GAAI,CAAA,KAAA,EAAO,CAAC,CAAA,CAAA;AAEzB,EAAA,IAAI,IAAI,IAAQ,GAAA,KAAA,CAAA;AAChB,EAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AAGR,EAAA,CAAA,IAAK,YAAY,CAAK,CAAA,GAAA,CAAA,CAAA;AAEtB,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,GAAQ,GAAG,CAC/B,EAAA,EAAA;AACI,IAAM,MAAA,EAAA,GAAK,IAAK,CAAA,GAAA,CAAI,CAAC,CAAA,CAAA;AACrB,IAAM,MAAA,EAAA,GAAK,IAAK,CAAA,GAAA,CAAI,CAAC,CAAA,CAAA;AAErB,IAAM,MAAA,EAAA,GAAK,IAAK,EAAK,GAAA,MAAA,CAAA;AACrB,IAAM,MAAA,EAAA,GAAK,IAAK,EAAK,GAAA,MAAA,CAAA;AAErB,IAAO,MAAA,CAAA,IAAA,CAAK,IAAI,EAAE,CAAA,CAAA;AAElB,IAAK,CAAA,IAAA,CAAA,CAAA;AAAA,GACT;AACJ;;;;"}
|
25
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs
generated
vendored
Normal file
25
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
function buildArc(points, x, y, radius, start, end, clockwise, steps) {
|
||||
let dist = Math.abs(start - end);
|
||||
if (!clockwise && start > end) {
|
||||
dist = 2 * Math.PI - dist;
|
||||
} else if (clockwise && end > start) {
|
||||
dist = 2 * Math.PI - dist;
|
||||
}
|
||||
steps = steps || Math.max(6, Math.floor(6 * Math.pow(radius, 1 / 3) * (dist / Math.PI)));
|
||||
steps = Math.max(steps, 3);
|
||||
let f = dist / steps;
|
||||
let t = start;
|
||||
f *= clockwise ? -1 : 1;
|
||||
for (let i = 0; i < steps + 1; i++) {
|
||||
const cs = Math.cos(t);
|
||||
const sn = Math.sin(t);
|
||||
const nx = x + cs * radius;
|
||||
const ny = y + sn * radius;
|
||||
points.push(nx, ny);
|
||||
t += f;
|
||||
}
|
||||
}
|
||||
|
||||
export { buildArc };
|
||||
//# sourceMappingURL=buildArc.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildArc.mjs","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildArc.ts"],"sourcesContent":["export function buildArc(\n points: number[],\n x: number, y: number,\n radius: number,\n start: number,\n end: number,\n clockwise: boolean,\n steps?: number\n)\n{\n // determine distance between the two angles\n // ...probably a nicer way of writing this\n let dist = Math.abs(start - end);\n\n if (!clockwise && start > end)\n {\n dist = (2 * Math.PI) - dist;\n }\n else if (clockwise && end > start)\n {\n dist = (2 * Math.PI) - dist;\n }\n\n // approximate the # of steps using the cube root of the radius\n\n steps = steps || Math.max(6, Math.floor(6 * Math.pow(radius, 1 / 3) * (dist / (Math.PI))));\n\n // ensure we have at least 3 steps..\n steps = Math.max(steps, 3);\n\n let f = dist / (steps);\n let t = start;\n\n // modify direction\n f *= clockwise ? -1 : 1;\n\n for (let i = 0; i < steps + 1; i++)\n {\n const cs = Math.cos(t);\n const sn = Math.sin(t);\n\n const nx = x + (cs * radius);\n const ny = y + (sn * radius);\n\n points.push(nx, ny);\n\n t += f;\n }\n}\n"],"names":[],"mappings":";AAAgB,SAAA,QAAA,CACZ,QACA,CAAW,EAAA,CAAA,EACX,QACA,KACA,EAAA,GAAA,EACA,WACA,KAEJ,EAAA;AAGI,EAAA,IAAI,IAAO,GAAA,IAAA,CAAK,GAAI,CAAA,KAAA,GAAQ,GAAG,CAAA,CAAA;AAE/B,EAAI,IAAA,CAAC,SAAa,IAAA,KAAA,GAAQ,GAC1B,EAAA;AACI,IAAQ,IAAA,GAAA,CAAA,GAAI,KAAK,EAAM,GAAA,IAAA,CAAA;AAAA,GAC3B,MAAA,IACS,SAAa,IAAA,GAAA,GAAM,KAC5B,EAAA;AACI,IAAQ,IAAA,GAAA,CAAA,GAAI,KAAK,EAAM,GAAA,IAAA,CAAA;AAAA,GAC3B;AAIA,EAAA,KAAA,GAAQ,SAAS,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,CAAK,MAAM,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,MAAA,EAAQ,IAAI,CAAC,CAAA,IAAK,IAAQ,GAAA,IAAA,CAAK,GAAI,CAAC,CAAA,CAAA;AAGzF,EAAQ,KAAA,GAAA,IAAA,CAAK,GAAI,CAAA,KAAA,EAAO,CAAC,CAAA,CAAA;AAEzB,EAAA,IAAI,IAAI,IAAQ,GAAA,KAAA,CAAA;AAChB,EAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AAGR,EAAA,CAAA,IAAK,YAAY,CAAK,CAAA,GAAA,CAAA,CAAA;AAEtB,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,GAAQ,GAAG,CAC/B,EAAA,EAAA;AACI,IAAM,MAAA,EAAA,GAAK,IAAK,CAAA,GAAA,CAAI,CAAC,CAAA,CAAA;AACrB,IAAM,MAAA,EAAA,GAAK,IAAK,CAAA,GAAA,CAAI,CAAC,CAAA,CAAA;AAErB,IAAM,MAAA,EAAA,GAAK,IAAK,EAAK,GAAA,MAAA,CAAA;AACrB,IAAM,MAAA,EAAA,GAAK,IAAK,EAAK,GAAA,MAAA,CAAA;AAErB,IAAO,MAAA,CAAA,IAAA,CAAK,IAAI,EAAE,CAAA,CAAA;AAElB,IAAK,CAAA,IAAA,CAAA,CAAA;AAAA,GACT;AACJ;;;;"}
|
12
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.d.ts
generated
vendored
Normal file
12
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* The arcTo() method creates an arc/curve between two tangents on the canvas.
|
||||
*
|
||||
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
|
||||
* @param points
|
||||
* @param x1
|
||||
* @param y1
|
||||
* @param x2
|
||||
* @param y2
|
||||
* @param radius
|
||||
*/
|
||||
export declare function buildArcTo(points: number[], x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
47
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.js
generated
vendored
Normal file
47
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
var buildArc = require('./buildArc.js');
|
||||
|
||||
"use strict";
|
||||
function buildArcTo(points, x1, y1, x2, y2, radius) {
|
||||
const fromX = points[points.length - 2];
|
||||
const fromY = points[points.length - 1];
|
||||
const a1 = fromY - y1;
|
||||
const b1 = fromX - x1;
|
||||
const a2 = y2 - y1;
|
||||
const b2 = x2 - x1;
|
||||
const mm = Math.abs(a1 * b2 - b1 * a2);
|
||||
if (mm < 1e-8 || radius === 0) {
|
||||
if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {
|
||||
points.push(x1, y1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const dd = a1 * a1 + b1 * b1;
|
||||
const cc = a2 * a2 + b2 * b2;
|
||||
const tt = a1 * a2 + b1 * b2;
|
||||
const k1 = radius * Math.sqrt(dd) / mm;
|
||||
const k2 = radius * Math.sqrt(cc) / mm;
|
||||
const j1 = k1 * tt / dd;
|
||||
const j2 = k2 * tt / cc;
|
||||
const cx = k1 * b2 + k2 * b1;
|
||||
const cy = k1 * a2 + k2 * a1;
|
||||
const px = b1 * (k2 + j1);
|
||||
const py = a1 * (k2 + j1);
|
||||
const qx = b2 * (k1 + j2);
|
||||
const qy = a2 * (k1 + j2);
|
||||
const startAngle = Math.atan2(py - cy, px - cx);
|
||||
const endAngle = Math.atan2(qy - cy, qx - cx);
|
||||
buildArc.buildArc(
|
||||
points,
|
||||
cx + x1,
|
||||
cy + y1,
|
||||
radius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
b1 * a2 > b2 * a1
|
||||
);
|
||||
}
|
||||
|
||||
exports.buildArcTo = buildArcTo;
|
||||
//# sourceMappingURL=buildArcTo.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildArcTo.js","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildArcTo.ts"],"sourcesContent":["import { buildArc } from './buildArc';\n\n/**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n * @param points\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\nexport function buildArcTo(\n points: number[],\n x1: number, y1: number,\n x2: number, y2: number,\n radius: number,\n): void\n{\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n buildArc(points,\n (cx + x1),\n (cy + y1),\n radius,\n startAngle,\n endAngle,\n b1 * a2 > b2 * a1\n );\n}\n"],"names":["buildArc"],"mappings":";;;;;AAaO,SAAS,WACZ,MACA,EAAA,EAAA,EAAY,EACZ,EAAA,EAAA,EAAY,IACZ,MAEJ,EAAA;AACI,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AACtC,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAEtC,EAAA,MAAM,KAAK,KAAQ,GAAA,EAAA,CAAA;AACnB,EAAA,MAAM,KAAK,KAAQ,GAAA,EAAA,CAAA;AACnB,EAAA,MAAM,KAAK,EAAK,GAAA,EAAA,CAAA;AAChB,EAAA,MAAM,KAAK,EAAK,GAAA,EAAA,CAAA;AAChB,EAAA,MAAM,KAAK,IAAK,CAAA,GAAA,CAAK,EAAK,GAAA,EAAA,GAAO,KAAK,EAAG,CAAA,CAAA;AAEzC,EAAI,IAAA,EAAA,GAAK,IAAU,IAAA,MAAA,KAAW,CAC9B,EAAA;AACI,IAAI,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,KAAM,EAAM,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,KAAM,EACtE,EAAA;AACI,MAAO,MAAA,CAAA,IAAA,CAAK,IAAI,EAAE,CAAA,CAAA;AAAA,KACtB;AAEA,IAAA,OAAA;AAAA,GACJ;AAEA,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAK,GAAA,MAAA,GAAS,IAAK,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAA,CAAA;AACpC,EAAA,MAAM,EAAK,GAAA,MAAA,GAAS,IAAK,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAA,CAAA;AACpC,EAAM,MAAA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA,CAAA;AACrB,EAAM,MAAA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA,CAAA;AACrB,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAA,MAAM,aAAa,IAAK,CAAA,KAAA,CAAM,EAAK,GAAA,EAAA,EAAI,KAAK,EAAE,CAAA,CAAA;AAC9C,EAAA,MAAM,WAAW,IAAK,CAAA,KAAA,CAAM,EAAK,GAAA,EAAA,EAAI,KAAK,EAAE,CAAA,CAAA;AAE5C,EAAAA,iBAAA;AAAA,IAAS,MAAA;AAAA,IACJ,EAAK,GAAA,EAAA;AAAA,IACL,EAAK,GAAA,EAAA;AAAA,IACN,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA;AAAA,GACnB,CAAA;AACJ;;;;"}
|
45
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.mjs
generated
vendored
Normal file
45
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.mjs
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { buildArc } from './buildArc.mjs';
|
||||
|
||||
"use strict";
|
||||
function buildArcTo(points, x1, y1, x2, y2, radius) {
|
||||
const fromX = points[points.length - 2];
|
||||
const fromY = points[points.length - 1];
|
||||
const a1 = fromY - y1;
|
||||
const b1 = fromX - x1;
|
||||
const a2 = y2 - y1;
|
||||
const b2 = x2 - x1;
|
||||
const mm = Math.abs(a1 * b2 - b1 * a2);
|
||||
if (mm < 1e-8 || radius === 0) {
|
||||
if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {
|
||||
points.push(x1, y1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const dd = a1 * a1 + b1 * b1;
|
||||
const cc = a2 * a2 + b2 * b2;
|
||||
const tt = a1 * a2 + b1 * b2;
|
||||
const k1 = radius * Math.sqrt(dd) / mm;
|
||||
const k2 = radius * Math.sqrt(cc) / mm;
|
||||
const j1 = k1 * tt / dd;
|
||||
const j2 = k2 * tt / cc;
|
||||
const cx = k1 * b2 + k2 * b1;
|
||||
const cy = k1 * a2 + k2 * a1;
|
||||
const px = b1 * (k2 + j1);
|
||||
const py = a1 * (k2 + j1);
|
||||
const qx = b2 * (k1 + j2);
|
||||
const qy = a2 * (k1 + j2);
|
||||
const startAngle = Math.atan2(py - cy, px - cx);
|
||||
const endAngle = Math.atan2(qy - cy, qx - cx);
|
||||
buildArc(
|
||||
points,
|
||||
cx + x1,
|
||||
cy + y1,
|
||||
radius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
b1 * a2 > b2 * a1
|
||||
);
|
||||
}
|
||||
|
||||
export { buildArcTo };
|
||||
//# sourceMappingURL=buildArcTo.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildArcTo.mjs","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildArcTo.ts"],"sourcesContent":["import { buildArc } from './buildArc';\n\n/**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n * @param points\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\nexport function buildArcTo(\n points: number[],\n x1: number, y1: number,\n x2: number, y2: number,\n radius: number,\n): void\n{\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n buildArc(points,\n (cx + x1),\n (cy + y1),\n radius,\n startAngle,\n endAngle,\n b1 * a2 > b2 * a1\n );\n}\n"],"names":[],"mappings":";;;AAaO,SAAS,WACZ,MACA,EAAA,EAAA,EAAY,EACZ,EAAA,EAAA,EAAY,IACZ,MAEJ,EAAA;AACI,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AACtC,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAEtC,EAAA,MAAM,KAAK,KAAQ,GAAA,EAAA,CAAA;AACnB,EAAA,MAAM,KAAK,KAAQ,GAAA,EAAA,CAAA;AACnB,EAAA,MAAM,KAAK,EAAK,GAAA,EAAA,CAAA;AAChB,EAAA,MAAM,KAAK,EAAK,GAAA,EAAA,CAAA;AAChB,EAAA,MAAM,KAAK,IAAK,CAAA,GAAA,CAAK,EAAK,GAAA,EAAA,GAAO,KAAK,EAAG,CAAA,CAAA;AAEzC,EAAI,IAAA,EAAA,GAAK,IAAU,IAAA,MAAA,KAAW,CAC9B,EAAA;AACI,IAAI,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,KAAM,EAAM,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,KAAM,EACtE,EAAA;AACI,MAAO,MAAA,CAAA,IAAA,CAAK,IAAI,EAAE,CAAA,CAAA;AAAA,KACtB;AAEA,IAAA,OAAA;AAAA,GACJ;AAEA,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAK,GAAA,MAAA,GAAS,IAAK,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAA,CAAA;AACpC,EAAA,MAAM,EAAK,GAAA,MAAA,GAAS,IAAK,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAA,CAAA;AACpC,EAAM,MAAA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA,CAAA;AACrB,EAAM,MAAA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA,CAAA;AACrB,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAM,EAAK,GAAA,EAAA,GAAO,EAAK,GAAA,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAM,MAAA,EAAA,GAAK,MAAM,EAAK,GAAA,EAAA,CAAA,CAAA;AACtB,EAAA,MAAM,aAAa,IAAK,CAAA,KAAA,CAAM,EAAK,GAAA,EAAA,EAAI,KAAK,EAAE,CAAA,CAAA;AAC9C,EAAA,MAAM,WAAW,IAAK,CAAA,KAAA,CAAM,EAAK,GAAA,EAAA,EAAI,KAAK,EAAE,CAAA,CAAA;AAE5C,EAAA,QAAA;AAAA,IAAS,MAAA;AAAA,IACJ,EAAK,GAAA,EAAA;AAAA,IACL,EAAK,GAAA,EAAA;AAAA,IACN,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,EAAA,GAAK,KAAK,EAAK,GAAA,EAAA;AAAA,GACnB,CAAA;AACJ;;;;"}
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function buildArcToSvg(points: number[], px: number, py: number, cx: number, cy: number, rx: number, ry: number, xAxisRotation?: number, largeArcFlag?: number, sweepFlag?: number): void;
|
154
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.js
generated
vendored
Normal file
154
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
'use strict';
|
||||
|
||||
var buildAdaptiveBezier = require('./buildAdaptiveBezier.js');
|
||||
|
||||
"use strict";
|
||||
const TAU = Math.PI * 2;
|
||||
const out = {
|
||||
centerX: 0,
|
||||
centerY: 0,
|
||||
ang1: 0,
|
||||
ang2: 0
|
||||
};
|
||||
const mapToEllipse = ({ x, y }, rx, ry, cosPhi, sinPhi, centerX, centerY, out2) => {
|
||||
x *= rx;
|
||||
y *= ry;
|
||||
const xp = cosPhi * x - sinPhi * y;
|
||||
const yp = sinPhi * x + cosPhi * y;
|
||||
out2.x = xp + centerX;
|
||||
out2.y = yp + centerY;
|
||||
return out2;
|
||||
};
|
||||
function approxUnitArc(ang1, ang2) {
|
||||
const a1 = ang2 === -1.5707963267948966 ? -0.551915024494 : 4 / 3 * Math.tan(ang2 / 4);
|
||||
const a = ang2 === 1.5707963267948966 ? 0.551915024494 : a1;
|
||||
const x1 = Math.cos(ang1);
|
||||
const y1 = Math.sin(ang1);
|
||||
const x2 = Math.cos(ang1 + ang2);
|
||||
const y2 = Math.sin(ang1 + ang2);
|
||||
return [
|
||||
{
|
||||
x: x1 - y1 * a,
|
||||
y: y1 + x1 * a
|
||||
},
|
||||
{
|
||||
x: x2 + y2 * a,
|
||||
y: y2 - x2 * a
|
||||
},
|
||||
{
|
||||
x: x2,
|
||||
y: y2
|
||||
}
|
||||
];
|
||||
}
|
||||
const vectorAngle = (ux, uy, vx, vy) => {
|
||||
const sign = ux * vy - uy * vx < 0 ? -1 : 1;
|
||||
let dot = ux * vx + uy * vy;
|
||||
if (dot > 1) {
|
||||
dot = 1;
|
||||
}
|
||||
if (dot < -1) {
|
||||
dot = -1;
|
||||
}
|
||||
return sign * Math.acos(dot);
|
||||
};
|
||||
const getArcCenter = (px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinPhi, cosPhi, pxp, pyp, out2) => {
|
||||
const rxSq = Math.pow(rx, 2);
|
||||
const rySq = Math.pow(ry, 2);
|
||||
const pxpSq = Math.pow(pxp, 2);
|
||||
const pypSq = Math.pow(pyp, 2);
|
||||
let radicant = rxSq * rySq - rxSq * pypSq - rySq * pxpSq;
|
||||
if (radicant < 0) {
|
||||
radicant = 0;
|
||||
}
|
||||
radicant /= rxSq * pypSq + rySq * pxpSq;
|
||||
radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);
|
||||
const centerXp = radicant * rx / ry * pyp;
|
||||
const centerYp = radicant * -ry / rx * pxp;
|
||||
const centerX = cosPhi * centerXp - sinPhi * centerYp + (px + cx) / 2;
|
||||
const centerY = sinPhi * centerXp + cosPhi * centerYp + (py + cy) / 2;
|
||||
const vx1 = (pxp - centerXp) / rx;
|
||||
const vy1 = (pyp - centerYp) / ry;
|
||||
const vx2 = (-pxp - centerXp) / rx;
|
||||
const vy2 = (-pyp - centerYp) / ry;
|
||||
const ang1 = vectorAngle(1, 0, vx1, vy1);
|
||||
let ang2 = vectorAngle(vx1, vy1, vx2, vy2);
|
||||
if (sweepFlag === 0 && ang2 > 0) {
|
||||
ang2 -= TAU;
|
||||
}
|
||||
if (sweepFlag === 1 && ang2 < 0) {
|
||||
ang2 += TAU;
|
||||
}
|
||||
out2.centerX = centerX;
|
||||
out2.centerY = centerY;
|
||||
out2.ang1 = ang1;
|
||||
out2.ang2 = ang2;
|
||||
};
|
||||
function buildArcToSvg(points, px, py, cx, cy, rx, ry, xAxisRotation = 0, largeArcFlag = 0, sweepFlag = 0) {
|
||||
if (rx === 0 || ry === 0) {
|
||||
return;
|
||||
}
|
||||
const sinPhi = Math.sin(xAxisRotation * TAU / 360);
|
||||
const cosPhi = Math.cos(xAxisRotation * TAU / 360);
|
||||
const pxp = cosPhi * (px - cx) / 2 + sinPhi * (py - cy) / 2;
|
||||
const pyp = -sinPhi * (px - cx) / 2 + cosPhi * (py - cy) / 2;
|
||||
if (pxp === 0 && pyp === 0) {
|
||||
return;
|
||||
}
|
||||
rx = Math.abs(rx);
|
||||
ry = Math.abs(ry);
|
||||
const lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);
|
||||
if (lambda > 1) {
|
||||
rx *= Math.sqrt(lambda);
|
||||
ry *= Math.sqrt(lambda);
|
||||
}
|
||||
getArcCenter(
|
||||
px,
|
||||
py,
|
||||
cx,
|
||||
cy,
|
||||
rx,
|
||||
ry,
|
||||
largeArcFlag,
|
||||
sweepFlag,
|
||||
sinPhi,
|
||||
cosPhi,
|
||||
pxp,
|
||||
pyp,
|
||||
out
|
||||
);
|
||||
let { ang1, ang2 } = out;
|
||||
const { centerX, centerY } = out;
|
||||
let ratio = Math.abs(ang2) / (TAU / 4);
|
||||
if (Math.abs(1 - ratio) < 1e-7) {
|
||||
ratio = 1;
|
||||
}
|
||||
const segments = Math.max(Math.ceil(ratio), 1);
|
||||
ang2 /= segments;
|
||||
let lastX = points[points.length - 2];
|
||||
let lastY = points[points.length - 1];
|
||||
const outCurvePoint = { x: 0, y: 0 };
|
||||
for (let i = 0; i < segments; i++) {
|
||||
const curve = approxUnitArc(ang1, ang2);
|
||||
const { x: x1, y: y1 } = mapToEllipse(curve[0], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
const { x: x2, y: y2 } = mapToEllipse(curve[1], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
const { x, y } = mapToEllipse(curve[2], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
buildAdaptiveBezier.buildAdaptiveBezier(
|
||||
points,
|
||||
lastX,
|
||||
lastY,
|
||||
x1,
|
||||
y1,
|
||||
x2,
|
||||
y2,
|
||||
x,
|
||||
y
|
||||
);
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
ang1 += ang2;
|
||||
}
|
||||
}
|
||||
|
||||
exports.buildArcToSvg = buildArcToSvg;
|
||||
//# sourceMappingURL=buildArcToSvg.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
152
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.mjs
generated
vendored
Normal file
152
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.mjs
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
import { buildAdaptiveBezier } from './buildAdaptiveBezier.mjs';
|
||||
|
||||
"use strict";
|
||||
const TAU = Math.PI * 2;
|
||||
const out = {
|
||||
centerX: 0,
|
||||
centerY: 0,
|
||||
ang1: 0,
|
||||
ang2: 0
|
||||
};
|
||||
const mapToEllipse = ({ x, y }, rx, ry, cosPhi, sinPhi, centerX, centerY, out2) => {
|
||||
x *= rx;
|
||||
y *= ry;
|
||||
const xp = cosPhi * x - sinPhi * y;
|
||||
const yp = sinPhi * x + cosPhi * y;
|
||||
out2.x = xp + centerX;
|
||||
out2.y = yp + centerY;
|
||||
return out2;
|
||||
};
|
||||
function approxUnitArc(ang1, ang2) {
|
||||
const a1 = ang2 === -1.5707963267948966 ? -0.551915024494 : 4 / 3 * Math.tan(ang2 / 4);
|
||||
const a = ang2 === 1.5707963267948966 ? 0.551915024494 : a1;
|
||||
const x1 = Math.cos(ang1);
|
||||
const y1 = Math.sin(ang1);
|
||||
const x2 = Math.cos(ang1 + ang2);
|
||||
const y2 = Math.sin(ang1 + ang2);
|
||||
return [
|
||||
{
|
||||
x: x1 - y1 * a,
|
||||
y: y1 + x1 * a
|
||||
},
|
||||
{
|
||||
x: x2 + y2 * a,
|
||||
y: y2 - x2 * a
|
||||
},
|
||||
{
|
||||
x: x2,
|
||||
y: y2
|
||||
}
|
||||
];
|
||||
}
|
||||
const vectorAngle = (ux, uy, vx, vy) => {
|
||||
const sign = ux * vy - uy * vx < 0 ? -1 : 1;
|
||||
let dot = ux * vx + uy * vy;
|
||||
if (dot > 1) {
|
||||
dot = 1;
|
||||
}
|
||||
if (dot < -1) {
|
||||
dot = -1;
|
||||
}
|
||||
return sign * Math.acos(dot);
|
||||
};
|
||||
const getArcCenter = (px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinPhi, cosPhi, pxp, pyp, out2) => {
|
||||
const rxSq = Math.pow(rx, 2);
|
||||
const rySq = Math.pow(ry, 2);
|
||||
const pxpSq = Math.pow(pxp, 2);
|
||||
const pypSq = Math.pow(pyp, 2);
|
||||
let radicant = rxSq * rySq - rxSq * pypSq - rySq * pxpSq;
|
||||
if (radicant < 0) {
|
||||
radicant = 0;
|
||||
}
|
||||
radicant /= rxSq * pypSq + rySq * pxpSq;
|
||||
radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);
|
||||
const centerXp = radicant * rx / ry * pyp;
|
||||
const centerYp = radicant * -ry / rx * pxp;
|
||||
const centerX = cosPhi * centerXp - sinPhi * centerYp + (px + cx) / 2;
|
||||
const centerY = sinPhi * centerXp + cosPhi * centerYp + (py + cy) / 2;
|
||||
const vx1 = (pxp - centerXp) / rx;
|
||||
const vy1 = (pyp - centerYp) / ry;
|
||||
const vx2 = (-pxp - centerXp) / rx;
|
||||
const vy2 = (-pyp - centerYp) / ry;
|
||||
const ang1 = vectorAngle(1, 0, vx1, vy1);
|
||||
let ang2 = vectorAngle(vx1, vy1, vx2, vy2);
|
||||
if (sweepFlag === 0 && ang2 > 0) {
|
||||
ang2 -= TAU;
|
||||
}
|
||||
if (sweepFlag === 1 && ang2 < 0) {
|
||||
ang2 += TAU;
|
||||
}
|
||||
out2.centerX = centerX;
|
||||
out2.centerY = centerY;
|
||||
out2.ang1 = ang1;
|
||||
out2.ang2 = ang2;
|
||||
};
|
||||
function buildArcToSvg(points, px, py, cx, cy, rx, ry, xAxisRotation = 0, largeArcFlag = 0, sweepFlag = 0) {
|
||||
if (rx === 0 || ry === 0) {
|
||||
return;
|
||||
}
|
||||
const sinPhi = Math.sin(xAxisRotation * TAU / 360);
|
||||
const cosPhi = Math.cos(xAxisRotation * TAU / 360);
|
||||
const pxp = cosPhi * (px - cx) / 2 + sinPhi * (py - cy) / 2;
|
||||
const pyp = -sinPhi * (px - cx) / 2 + cosPhi * (py - cy) / 2;
|
||||
if (pxp === 0 && pyp === 0) {
|
||||
return;
|
||||
}
|
||||
rx = Math.abs(rx);
|
||||
ry = Math.abs(ry);
|
||||
const lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);
|
||||
if (lambda > 1) {
|
||||
rx *= Math.sqrt(lambda);
|
||||
ry *= Math.sqrt(lambda);
|
||||
}
|
||||
getArcCenter(
|
||||
px,
|
||||
py,
|
||||
cx,
|
||||
cy,
|
||||
rx,
|
||||
ry,
|
||||
largeArcFlag,
|
||||
sweepFlag,
|
||||
sinPhi,
|
||||
cosPhi,
|
||||
pxp,
|
||||
pyp,
|
||||
out
|
||||
);
|
||||
let { ang1, ang2 } = out;
|
||||
const { centerX, centerY } = out;
|
||||
let ratio = Math.abs(ang2) / (TAU / 4);
|
||||
if (Math.abs(1 - ratio) < 1e-7) {
|
||||
ratio = 1;
|
||||
}
|
||||
const segments = Math.max(Math.ceil(ratio), 1);
|
||||
ang2 /= segments;
|
||||
let lastX = points[points.length - 2];
|
||||
let lastY = points[points.length - 1];
|
||||
const outCurvePoint = { x: 0, y: 0 };
|
||||
for (let i = 0; i < segments; i++) {
|
||||
const curve = approxUnitArc(ang1, ang2);
|
||||
const { x: x1, y: y1 } = mapToEllipse(curve[0], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
const { x: x2, y: y2 } = mapToEllipse(curve[1], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
const { x, y } = mapToEllipse(curve[2], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);
|
||||
buildAdaptiveBezier(
|
||||
points,
|
||||
lastX,
|
||||
lastY,
|
||||
x1,
|
||||
y1,
|
||||
x2,
|
||||
y2,
|
||||
x,
|
||||
y
|
||||
);
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
ang1 += ang2;
|
||||
}
|
||||
}
|
||||
|
||||
export { buildArcToSvg };
|
||||
//# sourceMappingURL=buildArcToSvg.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.d.ts
generated
vendored
Normal file
33
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ExtensionType } from '../../../../extensions/Extensions';
|
||||
import type { Circle } from '../../../../maths/shapes/Circle';
|
||||
import type { Ellipse } from '../../../../maths/shapes/Ellipse';
|
||||
import type { RoundedRectangle } from '../../../../maths/shapes/RoundedRectangle';
|
||||
import type { ShapeBuildCommand } from './ShapeBuildCommand';
|
||||
type RoundedShape = Circle | Ellipse | RoundedRectangle;
|
||||
/**
|
||||
* Builds a rectangle to draw
|
||||
*
|
||||
* Ignored from docs since it is not directly exposed.
|
||||
* @ignore
|
||||
* @private
|
||||
*/
|
||||
export declare const buildCircle: ShapeBuildCommand<RoundedShape>;
|
||||
export declare const buildEllipse: {
|
||||
extension: {
|
||||
name: string;
|
||||
type: ExtensionType | ExtensionType[];
|
||||
priority?: number;
|
||||
};
|
||||
build(shape: RoundedShape, points: number[]): void;
|
||||
triangulate(points: number[], vertices: number[], verticesStride: number, verticesOffset: number, indices: number[], indicesOffset: number): void;
|
||||
};
|
||||
export declare const buildRoundedRectangle: {
|
||||
extension: {
|
||||
name: string;
|
||||
type: ExtensionType | ExtensionType[];
|
||||
priority?: number;
|
||||
};
|
||||
build(shape: RoundedShape, points: number[]): void;
|
||||
triangulate(points: number[], vertices: number[], verticesStride: number, verticesOffset: number, indices: number[], indicesOffset: number): void;
|
||||
};
|
||||
export {};
|
148
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.js
generated
vendored
Normal file
148
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
const buildCircle = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.ShapeBuilder,
|
||||
name: "circle"
|
||||
},
|
||||
build(shape, points) {
|
||||
let x;
|
||||
let y;
|
||||
let dx;
|
||||
let dy;
|
||||
let rx;
|
||||
let ry;
|
||||
if (shape.type === "circle") {
|
||||
const circle = shape;
|
||||
x = circle.x;
|
||||
y = circle.y;
|
||||
rx = ry = circle.radius;
|
||||
dx = dy = 0;
|
||||
} else if (shape.type === "ellipse") {
|
||||
const ellipse = shape;
|
||||
x = ellipse.x;
|
||||
y = ellipse.y;
|
||||
rx = ellipse.halfWidth;
|
||||
ry = ellipse.halfHeight;
|
||||
dx = dy = 0;
|
||||
} else {
|
||||
const roundedRect = shape;
|
||||
const halfWidth = roundedRect.width / 2;
|
||||
const halfHeight = roundedRect.height / 2;
|
||||
x = roundedRect.x + halfWidth;
|
||||
y = roundedRect.y + halfHeight;
|
||||
rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight)));
|
||||
dx = halfWidth - rx;
|
||||
dy = halfHeight - ry;
|
||||
}
|
||||
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
||||
return points;
|
||||
}
|
||||
const n = Math.ceil(2.3 * Math.sqrt(rx + ry));
|
||||
const m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
|
||||
if (m === 0) {
|
||||
return points;
|
||||
}
|
||||
if (n === 0) {
|
||||
points[0] = points[6] = x + dx;
|
||||
points[1] = points[3] = y + dy;
|
||||
points[2] = points[4] = x - dx;
|
||||
points[5] = points[7] = y - dy;
|
||||
return points;
|
||||
}
|
||||
let j1 = 0;
|
||||
let j2 = n * 4 + (dx ? 2 : 0) + 2;
|
||||
let j3 = j2;
|
||||
let j4 = m;
|
||||
let x0 = dx + rx;
|
||||
let y0 = dy;
|
||||
let x1 = x + x0;
|
||||
let x2 = x - x0;
|
||||
let y1 = y + y0;
|
||||
points[j1++] = x1;
|
||||
points[j1++] = y1;
|
||||
points[--j2] = y1;
|
||||
points[--j2] = x2;
|
||||
if (dy) {
|
||||
const y22 = y - y0;
|
||||
points[j3++] = x2;
|
||||
points[j3++] = y22;
|
||||
points[--j4] = y22;
|
||||
points[--j4] = x1;
|
||||
}
|
||||
for (let i = 1; i < n; i++) {
|
||||
const a = Math.PI / 2 * (i / n);
|
||||
const x02 = dx + Math.cos(a) * rx;
|
||||
const y02 = dy + Math.sin(a) * ry;
|
||||
const x12 = x + x02;
|
||||
const x22 = x - x02;
|
||||
const y12 = y + y02;
|
||||
const y22 = y - y02;
|
||||
points[j1++] = x12;
|
||||
points[j1++] = y12;
|
||||
points[--j2] = y12;
|
||||
points[--j2] = x22;
|
||||
points[j3++] = x22;
|
||||
points[j3++] = y22;
|
||||
points[--j4] = y22;
|
||||
points[--j4] = x12;
|
||||
}
|
||||
x0 = dx;
|
||||
y0 = dy + ry;
|
||||
x1 = x + x0;
|
||||
x2 = x - x0;
|
||||
y1 = y + y0;
|
||||
const y2 = y - y0;
|
||||
points[j1++] = x1;
|
||||
points[j1++] = y1;
|
||||
points[--j4] = y2;
|
||||
points[--j4] = x1;
|
||||
if (dx) {
|
||||
points[j1++] = x2;
|
||||
points[j1++] = y1;
|
||||
points[--j4] = y2;
|
||||
points[--j4] = x2;
|
||||
}
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
if (points.length === 0) {
|
||||
return;
|
||||
}
|
||||
let centerX = 0;
|
||||
let centerY = 0;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
centerX += points[i];
|
||||
centerY += points[i + 1];
|
||||
}
|
||||
centerX /= points.length / 2;
|
||||
centerY /= points.length / 2;
|
||||
let count = verticesOffset;
|
||||
vertices[count * verticesStride] = centerX;
|
||||
vertices[count * verticesStride + 1] = centerY;
|
||||
const centerIndex = count++;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
vertices[count * verticesStride] = points[i];
|
||||
vertices[count * verticesStride + 1] = points[i + 1];
|
||||
if (i > 0) {
|
||||
indices[indicesOffset++] = count;
|
||||
indices[indicesOffset++] = centerIndex;
|
||||
indices[indicesOffset++] = count - 1;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
indices[indicesOffset++] = centerIndex + 1;
|
||||
indices[indicesOffset++] = centerIndex;
|
||||
indices[indicesOffset++] = count - 1;
|
||||
}
|
||||
};
|
||||
const buildEllipse = { ...buildCircle, extension: { ...buildCircle.extension, name: "ellipse" } };
|
||||
const buildRoundedRectangle = { ...buildCircle, extension: { ...buildCircle.extension, name: "roundedRectangle" } };
|
||||
|
||||
exports.buildCircle = buildCircle;
|
||||
exports.buildEllipse = buildEllipse;
|
||||
exports.buildRoundedRectangle = buildRoundedRectangle;
|
||||
//# sourceMappingURL=buildCircle.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
144
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.mjs
generated
vendored
Normal file
144
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.mjs
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
const buildCircle = {
|
||||
extension: {
|
||||
type: ExtensionType.ShapeBuilder,
|
||||
name: "circle"
|
||||
},
|
||||
build(shape, points) {
|
||||
let x;
|
||||
let y;
|
||||
let dx;
|
||||
let dy;
|
||||
let rx;
|
||||
let ry;
|
||||
if (shape.type === "circle") {
|
||||
const circle = shape;
|
||||
x = circle.x;
|
||||
y = circle.y;
|
||||
rx = ry = circle.radius;
|
||||
dx = dy = 0;
|
||||
} else if (shape.type === "ellipse") {
|
||||
const ellipse = shape;
|
||||
x = ellipse.x;
|
||||
y = ellipse.y;
|
||||
rx = ellipse.halfWidth;
|
||||
ry = ellipse.halfHeight;
|
||||
dx = dy = 0;
|
||||
} else {
|
||||
const roundedRect = shape;
|
||||
const halfWidth = roundedRect.width / 2;
|
||||
const halfHeight = roundedRect.height / 2;
|
||||
x = roundedRect.x + halfWidth;
|
||||
y = roundedRect.y + halfHeight;
|
||||
rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight)));
|
||||
dx = halfWidth - rx;
|
||||
dy = halfHeight - ry;
|
||||
}
|
||||
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
||||
return points;
|
||||
}
|
||||
const n = Math.ceil(2.3 * Math.sqrt(rx + ry));
|
||||
const m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
|
||||
if (m === 0) {
|
||||
return points;
|
||||
}
|
||||
if (n === 0) {
|
||||
points[0] = points[6] = x + dx;
|
||||
points[1] = points[3] = y + dy;
|
||||
points[2] = points[4] = x - dx;
|
||||
points[5] = points[7] = y - dy;
|
||||
return points;
|
||||
}
|
||||
let j1 = 0;
|
||||
let j2 = n * 4 + (dx ? 2 : 0) + 2;
|
||||
let j3 = j2;
|
||||
let j4 = m;
|
||||
let x0 = dx + rx;
|
||||
let y0 = dy;
|
||||
let x1 = x + x0;
|
||||
let x2 = x - x0;
|
||||
let y1 = y + y0;
|
||||
points[j1++] = x1;
|
||||
points[j1++] = y1;
|
||||
points[--j2] = y1;
|
||||
points[--j2] = x2;
|
||||
if (dy) {
|
||||
const y22 = y - y0;
|
||||
points[j3++] = x2;
|
||||
points[j3++] = y22;
|
||||
points[--j4] = y22;
|
||||
points[--j4] = x1;
|
||||
}
|
||||
for (let i = 1; i < n; i++) {
|
||||
const a = Math.PI / 2 * (i / n);
|
||||
const x02 = dx + Math.cos(a) * rx;
|
||||
const y02 = dy + Math.sin(a) * ry;
|
||||
const x12 = x + x02;
|
||||
const x22 = x - x02;
|
||||
const y12 = y + y02;
|
||||
const y22 = y - y02;
|
||||
points[j1++] = x12;
|
||||
points[j1++] = y12;
|
||||
points[--j2] = y12;
|
||||
points[--j2] = x22;
|
||||
points[j3++] = x22;
|
||||
points[j3++] = y22;
|
||||
points[--j4] = y22;
|
||||
points[--j4] = x12;
|
||||
}
|
||||
x0 = dx;
|
||||
y0 = dy + ry;
|
||||
x1 = x + x0;
|
||||
x2 = x - x0;
|
||||
y1 = y + y0;
|
||||
const y2 = y - y0;
|
||||
points[j1++] = x1;
|
||||
points[j1++] = y1;
|
||||
points[--j4] = y2;
|
||||
points[--j4] = x1;
|
||||
if (dx) {
|
||||
points[j1++] = x2;
|
||||
points[j1++] = y1;
|
||||
points[--j4] = y2;
|
||||
points[--j4] = x2;
|
||||
}
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
if (points.length === 0) {
|
||||
return;
|
||||
}
|
||||
let centerX = 0;
|
||||
let centerY = 0;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
centerX += points[i];
|
||||
centerY += points[i + 1];
|
||||
}
|
||||
centerX /= points.length / 2;
|
||||
centerY /= points.length / 2;
|
||||
let count = verticesOffset;
|
||||
vertices[count * verticesStride] = centerX;
|
||||
vertices[count * verticesStride + 1] = centerY;
|
||||
const centerIndex = count++;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
vertices[count * verticesStride] = points[i];
|
||||
vertices[count * verticesStride + 1] = points[i + 1];
|
||||
if (i > 0) {
|
||||
indices[indicesOffset++] = count;
|
||||
indices[indicesOffset++] = centerIndex;
|
||||
indices[indicesOffset++] = count - 1;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
indices[indicesOffset++] = centerIndex + 1;
|
||||
indices[indicesOffset++] = centerIndex;
|
||||
indices[indicesOffset++] = count - 1;
|
||||
}
|
||||
};
|
||||
const buildEllipse = { ...buildCircle, extension: { ...buildCircle.extension, name: "ellipse" } };
|
||||
const buildRoundedRectangle = { ...buildCircle, extension: { ...buildCircle.extension, name: "roundedRectangle" } };
|
||||
|
||||
export { buildCircle, buildEllipse, buildRoundedRectangle };
|
||||
//# sourceMappingURL=buildCircle.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.d.ts
generated
vendored
Normal file
14
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { StrokeAttributes } from '../FillTypes';
|
||||
/**
|
||||
* Builds a line to draw using the polygon method.
|
||||
* @param points
|
||||
* @param lineStyle
|
||||
* @param flipAlignment
|
||||
* @param closed
|
||||
* @param vertices
|
||||
* @param _verticesStride
|
||||
* @param _verticesOffset
|
||||
* @param indices
|
||||
* @param _indicesOffset
|
||||
*/
|
||||
export declare function buildLine(points: number[], lineStyle: StrokeAttributes, flipAlignment: boolean, closed: boolean, vertices: number[], _verticesStride: number, _verticesOffset: number, indices: number[], _indicesOffset: number): void;
|
365
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.js
generated
vendored
Normal file
365
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.js
generated
vendored
Normal file
@@ -0,0 +1,365 @@
|
||||
'use strict';
|
||||
|
||||
var Point = require('../../../../maths/point/Point.js');
|
||||
var _const = require('../const.js');
|
||||
var getOrientationOfPoints = require('../utils/getOrientationOfPoints.js');
|
||||
|
||||
"use strict";
|
||||
function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
|
||||
const ix = x - nx * innerWeight;
|
||||
const iy = y - ny * innerWeight;
|
||||
const ox = x + nx * outerWeight;
|
||||
const oy = y + ny * outerWeight;
|
||||
let exx;
|
||||
let eyy;
|
||||
if (clockwise) {
|
||||
exx = ny;
|
||||
eyy = -nx;
|
||||
} else {
|
||||
exx = -ny;
|
||||
eyy = nx;
|
||||
}
|
||||
const eix = ix + exx;
|
||||
const eiy = iy + eyy;
|
||||
const eox = ox + exx;
|
||||
const eoy = oy + eyy;
|
||||
verts.push(eix, eiy);
|
||||
verts.push(eox, eoy);
|
||||
return 2;
|
||||
}
|
||||
function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
||||
const cx2p0x = sx - cx;
|
||||
const cy2p0y = sy - cy;
|
||||
let angle0 = Math.atan2(cx2p0x, cy2p0y);
|
||||
let angle1 = Math.atan2(ex - cx, ey - cy);
|
||||
if (clockwise && angle0 < angle1) {
|
||||
angle0 += Math.PI * 2;
|
||||
} else if (!clockwise && angle0 > angle1) {
|
||||
angle1 += Math.PI * 2;
|
||||
}
|
||||
let startAngle = angle0;
|
||||
const angleDiff = angle1 - angle0;
|
||||
const absAngleDiff = Math.abs(angleDiff);
|
||||
const radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);
|
||||
const segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;
|
||||
const angleInc = angleDiff / segCount;
|
||||
startAngle += angleInc;
|
||||
if (clockwise) {
|
||||
verts.push(cx, cy);
|
||||
verts.push(sx, sy);
|
||||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
|
||||
verts.push(cx, cy);
|
||||
verts.push(
|
||||
cx + Math.sin(angle) * radius,
|
||||
cy + Math.cos(angle) * radius
|
||||
);
|
||||
}
|
||||
verts.push(cx, cy);
|
||||
verts.push(ex, ey);
|
||||
} else {
|
||||
verts.push(sx, sy);
|
||||
verts.push(cx, cy);
|
||||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
|
||||
verts.push(
|
||||
cx + Math.sin(angle) * radius,
|
||||
cy + Math.cos(angle) * radius
|
||||
);
|
||||
verts.push(cx, cy);
|
||||
}
|
||||
verts.push(ex, ey);
|
||||
verts.push(cx, cy);
|
||||
}
|
||||
return segCount * 2;
|
||||
}
|
||||
function buildLine(points, lineStyle, flipAlignment, closed, vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
||||
const eps = _const.closePointEps;
|
||||
if (points.length === 0) {
|
||||
return;
|
||||
}
|
||||
const style = lineStyle;
|
||||
let alignment = style.alignment;
|
||||
if (lineStyle.alignment !== 0.5) {
|
||||
let orientation = getOrientationOfPoints.getOrientationOfPoints(points);
|
||||
if (flipAlignment)
|
||||
orientation *= -1;
|
||||
alignment = (alignment - 0.5) * orientation + 0.5;
|
||||
}
|
||||
const firstPoint = new Point.Point(points[0], points[1]);
|
||||
const lastPoint = new Point.Point(points[points.length - 2], points[points.length - 1]);
|
||||
const closedShape = closed;
|
||||
const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
|
||||
if (closedShape) {
|
||||
points = points.slice();
|
||||
if (closedPath) {
|
||||
points.pop();
|
||||
points.pop();
|
||||
lastPoint.set(points[points.length - 2], points[points.length - 1]);
|
||||
}
|
||||
const midPointX = (firstPoint.x + lastPoint.x) * 0.5;
|
||||
const midPointY = (lastPoint.y + firstPoint.y) * 0.5;
|
||||
points.unshift(midPointX, midPointY);
|
||||
points.push(midPointX, midPointY);
|
||||
}
|
||||
const verts = vertices;
|
||||
const length = points.length / 2;
|
||||
let indexCount = points.length;
|
||||
const indexStart = verts.length / 2;
|
||||
const width = style.width / 2;
|
||||
const widthSquared = width * width;
|
||||
const miterLimitSquared = style.miterLimit * style.miterLimit;
|
||||
let x0 = points[0];
|
||||
let y0 = points[1];
|
||||
let x1 = points[2];
|
||||
let y1 = points[3];
|
||||
let x2 = 0;
|
||||
let y2 = 0;
|
||||
let perpX = -(y0 - y1);
|
||||
let perpY = x0 - x1;
|
||||
let perp1x = 0;
|
||||
let perp1y = 0;
|
||||
let dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
const ratio = alignment;
|
||||
const innerWeight = (1 - ratio) * 2;
|
||||
const outerWeight = ratio * 2;
|
||||
if (!closedShape) {
|
||||
if (style.cap === "round") {
|
||||
indexCount += round(
|
||||
x0 - perpX * (innerWeight - outerWeight) * 0.5,
|
||||
y0 - perpY * (innerWeight - outerWeight) * 0.5,
|
||||
x0 - perpX * innerWeight,
|
||||
y0 - perpY * innerWeight,
|
||||
x0 + perpX * outerWeight,
|
||||
y0 + perpY * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 2;
|
||||
} else if (style.cap === "square") {
|
||||
indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);
|
||||
}
|
||||
}
|
||||
verts.push(
|
||||
x0 - perpX * innerWeight,
|
||||
y0 - perpY * innerWeight
|
||||
);
|
||||
verts.push(
|
||||
x0 + perpX * outerWeight,
|
||||
y0 + perpY * outerWeight
|
||||
);
|
||||
for (let i = 1; i < length - 1; ++i) {
|
||||
x0 = points[(i - 1) * 2];
|
||||
y0 = points[(i - 1) * 2 + 1];
|
||||
x1 = points[i * 2];
|
||||
y1 = points[i * 2 + 1];
|
||||
x2 = points[(i + 1) * 2];
|
||||
y2 = points[(i + 1) * 2 + 1];
|
||||
perpX = -(y0 - y1);
|
||||
perpY = x0 - x1;
|
||||
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
perp1x = -(y1 - y2);
|
||||
perp1y = x1 - x2;
|
||||
dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
|
||||
perp1x /= dist;
|
||||
perp1y /= dist;
|
||||
perp1x *= width;
|
||||
perp1y *= width;
|
||||
const dx0 = x1 - x0;
|
||||
const dy0 = y0 - y1;
|
||||
const dx1 = x1 - x2;
|
||||
const dy1 = y2 - y1;
|
||||
const dot = dx0 * dx1 + dy0 * dy1;
|
||||
const cross = dy0 * dx1 - dy1 * dx0;
|
||||
const clockwise = cross < 0;
|
||||
if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
|
||||
verts.push(
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight
|
||||
);
|
||||
verts.push(
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight
|
||||
);
|
||||
if (dot >= 0) {
|
||||
if (style.join === "round") {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 4;
|
||||
} else {
|
||||
indexCount += 2;
|
||||
}
|
||||
verts.push(
|
||||
x1 - perp1x * outerWeight,
|
||||
y1 - perp1y * outerWeight
|
||||
);
|
||||
verts.push(
|
||||
x1 + perp1x * innerWeight,
|
||||
y1 + perp1y * innerWeight
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const c1 = (-perpX + x0) * (-perpY + y1) - (-perpX + x1) * (-perpY + y0);
|
||||
const c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);
|
||||
const px = (dx0 * c2 - dx1 * c1) / cross;
|
||||
const py = (dy1 * c1 - dy0 * c2) / cross;
|
||||
const pDist = (px - x1) * (px - x1) + (py - y1) * (py - y1);
|
||||
const imx = x1 + (px - x1) * innerWeight;
|
||||
const imy = y1 + (py - y1) * innerWeight;
|
||||
const omx = x1 - (px - x1) * outerWeight;
|
||||
const omy = y1 - (py - y1) * outerWeight;
|
||||
const smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);
|
||||
const insideWeight = clockwise ? innerWeight : outerWeight;
|
||||
const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
|
||||
const insideMiterOk = pDist <= smallerInsideDiagonalSq;
|
||||
if (insideMiterOk) {
|
||||
if (style.join === "bevel" || pDist / widthSquared > miterLimitSquared) {
|
||||
if (clockwise) {
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
indexCount += 2;
|
||||
} else if (style.join === "round") {
|
||||
if (clockwise) {
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
x1 + perp1x * outerWeight,
|
||||
y1 + perp1y * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 4;
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 4;
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
} else {
|
||||
verts.push(imx, imy);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
if (style.join === "round") {
|
||||
if (clockwise) {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
x1 + perp1x * outerWeight,
|
||||
y1 + perp1y * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 2;
|
||||
} else {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 2;
|
||||
}
|
||||
} else if (style.join === "miter" && pDist / widthSquared <= miterLimitSquared) {
|
||||
if (clockwise) {
|
||||
verts.push(omx, omy);
|
||||
verts.push(omx, omy);
|
||||
} else {
|
||||
verts.push(imx, imy);
|
||||
verts.push(imx, imy);
|
||||
}
|
||||
indexCount += 2;
|
||||
}
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
indexCount += 2;
|
||||
}
|
||||
}
|
||||
x0 = points[(length - 2) * 2];
|
||||
y0 = points[(length - 2) * 2 + 1];
|
||||
x1 = points[(length - 1) * 2];
|
||||
y1 = points[(length - 1) * 2 + 1];
|
||||
perpX = -(y0 - y1);
|
||||
perpY = x0 - x1;
|
||||
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
if (!closedShape) {
|
||||
if (style.cap === "round") {
|
||||
indexCount += round(
|
||||
x1 - perpX * (innerWeight - outerWeight) * 0.5,
|
||||
y1 - perpY * (innerWeight - outerWeight) * 0.5,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 2;
|
||||
} else if (style.cap === "square") {
|
||||
indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);
|
||||
}
|
||||
}
|
||||
const eps2 = _const.curveEps * _const.curveEps;
|
||||
for (let i = indexStart; i < indexCount + indexStart - 2; ++i) {
|
||||
x0 = verts[i * 2];
|
||||
y0 = verts[i * 2 + 1];
|
||||
x1 = verts[(i + 1) * 2];
|
||||
y1 = verts[(i + 1) * 2 + 1];
|
||||
x2 = verts[(i + 2) * 2];
|
||||
y2 = verts[(i + 2) * 2 + 1];
|
||||
if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {
|
||||
continue;
|
||||
}
|
||||
indices.push(i, i + 1, i + 2);
|
||||
}
|
||||
}
|
||||
|
||||
exports.buildLine = buildLine;
|
||||
//# sourceMappingURL=buildLine.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
363
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.mjs
generated
vendored
Normal file
363
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.mjs
generated
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
import { Point } from '../../../../maths/point/Point.mjs';
|
||||
import { closePointEps, curveEps } from '../const.mjs';
|
||||
import { getOrientationOfPoints } from '../utils/getOrientationOfPoints.mjs';
|
||||
|
||||
"use strict";
|
||||
function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
|
||||
const ix = x - nx * innerWeight;
|
||||
const iy = y - ny * innerWeight;
|
||||
const ox = x + nx * outerWeight;
|
||||
const oy = y + ny * outerWeight;
|
||||
let exx;
|
||||
let eyy;
|
||||
if (clockwise) {
|
||||
exx = ny;
|
||||
eyy = -nx;
|
||||
} else {
|
||||
exx = -ny;
|
||||
eyy = nx;
|
||||
}
|
||||
const eix = ix + exx;
|
||||
const eiy = iy + eyy;
|
||||
const eox = ox + exx;
|
||||
const eoy = oy + eyy;
|
||||
verts.push(eix, eiy);
|
||||
verts.push(eox, eoy);
|
||||
return 2;
|
||||
}
|
||||
function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
||||
const cx2p0x = sx - cx;
|
||||
const cy2p0y = sy - cy;
|
||||
let angle0 = Math.atan2(cx2p0x, cy2p0y);
|
||||
let angle1 = Math.atan2(ex - cx, ey - cy);
|
||||
if (clockwise && angle0 < angle1) {
|
||||
angle0 += Math.PI * 2;
|
||||
} else if (!clockwise && angle0 > angle1) {
|
||||
angle1 += Math.PI * 2;
|
||||
}
|
||||
let startAngle = angle0;
|
||||
const angleDiff = angle1 - angle0;
|
||||
const absAngleDiff = Math.abs(angleDiff);
|
||||
const radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);
|
||||
const segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;
|
||||
const angleInc = angleDiff / segCount;
|
||||
startAngle += angleInc;
|
||||
if (clockwise) {
|
||||
verts.push(cx, cy);
|
||||
verts.push(sx, sy);
|
||||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
|
||||
verts.push(cx, cy);
|
||||
verts.push(
|
||||
cx + Math.sin(angle) * radius,
|
||||
cy + Math.cos(angle) * radius
|
||||
);
|
||||
}
|
||||
verts.push(cx, cy);
|
||||
verts.push(ex, ey);
|
||||
} else {
|
||||
verts.push(sx, sy);
|
||||
verts.push(cx, cy);
|
||||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
|
||||
verts.push(
|
||||
cx + Math.sin(angle) * radius,
|
||||
cy + Math.cos(angle) * radius
|
||||
);
|
||||
verts.push(cx, cy);
|
||||
}
|
||||
verts.push(ex, ey);
|
||||
verts.push(cx, cy);
|
||||
}
|
||||
return segCount * 2;
|
||||
}
|
||||
function buildLine(points, lineStyle, flipAlignment, closed, vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
||||
const eps = closePointEps;
|
||||
if (points.length === 0) {
|
||||
return;
|
||||
}
|
||||
const style = lineStyle;
|
||||
let alignment = style.alignment;
|
||||
if (lineStyle.alignment !== 0.5) {
|
||||
let orientation = getOrientationOfPoints(points);
|
||||
if (flipAlignment)
|
||||
orientation *= -1;
|
||||
alignment = (alignment - 0.5) * orientation + 0.5;
|
||||
}
|
||||
const firstPoint = new Point(points[0], points[1]);
|
||||
const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);
|
||||
const closedShape = closed;
|
||||
const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
|
||||
if (closedShape) {
|
||||
points = points.slice();
|
||||
if (closedPath) {
|
||||
points.pop();
|
||||
points.pop();
|
||||
lastPoint.set(points[points.length - 2], points[points.length - 1]);
|
||||
}
|
||||
const midPointX = (firstPoint.x + lastPoint.x) * 0.5;
|
||||
const midPointY = (lastPoint.y + firstPoint.y) * 0.5;
|
||||
points.unshift(midPointX, midPointY);
|
||||
points.push(midPointX, midPointY);
|
||||
}
|
||||
const verts = vertices;
|
||||
const length = points.length / 2;
|
||||
let indexCount = points.length;
|
||||
const indexStart = verts.length / 2;
|
||||
const width = style.width / 2;
|
||||
const widthSquared = width * width;
|
||||
const miterLimitSquared = style.miterLimit * style.miterLimit;
|
||||
let x0 = points[0];
|
||||
let y0 = points[1];
|
||||
let x1 = points[2];
|
||||
let y1 = points[3];
|
||||
let x2 = 0;
|
||||
let y2 = 0;
|
||||
let perpX = -(y0 - y1);
|
||||
let perpY = x0 - x1;
|
||||
let perp1x = 0;
|
||||
let perp1y = 0;
|
||||
let dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
const ratio = alignment;
|
||||
const innerWeight = (1 - ratio) * 2;
|
||||
const outerWeight = ratio * 2;
|
||||
if (!closedShape) {
|
||||
if (style.cap === "round") {
|
||||
indexCount += round(
|
||||
x0 - perpX * (innerWeight - outerWeight) * 0.5,
|
||||
y0 - perpY * (innerWeight - outerWeight) * 0.5,
|
||||
x0 - perpX * innerWeight,
|
||||
y0 - perpY * innerWeight,
|
||||
x0 + perpX * outerWeight,
|
||||
y0 + perpY * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 2;
|
||||
} else if (style.cap === "square") {
|
||||
indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);
|
||||
}
|
||||
}
|
||||
verts.push(
|
||||
x0 - perpX * innerWeight,
|
||||
y0 - perpY * innerWeight
|
||||
);
|
||||
verts.push(
|
||||
x0 + perpX * outerWeight,
|
||||
y0 + perpY * outerWeight
|
||||
);
|
||||
for (let i = 1; i < length - 1; ++i) {
|
||||
x0 = points[(i - 1) * 2];
|
||||
y0 = points[(i - 1) * 2 + 1];
|
||||
x1 = points[i * 2];
|
||||
y1 = points[i * 2 + 1];
|
||||
x2 = points[(i + 1) * 2];
|
||||
y2 = points[(i + 1) * 2 + 1];
|
||||
perpX = -(y0 - y1);
|
||||
perpY = x0 - x1;
|
||||
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
perp1x = -(y1 - y2);
|
||||
perp1y = x1 - x2;
|
||||
dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
|
||||
perp1x /= dist;
|
||||
perp1y /= dist;
|
||||
perp1x *= width;
|
||||
perp1y *= width;
|
||||
const dx0 = x1 - x0;
|
||||
const dy0 = y0 - y1;
|
||||
const dx1 = x1 - x2;
|
||||
const dy1 = y2 - y1;
|
||||
const dot = dx0 * dx1 + dy0 * dy1;
|
||||
const cross = dy0 * dx1 - dy1 * dx0;
|
||||
const clockwise = cross < 0;
|
||||
if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
|
||||
verts.push(
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight
|
||||
);
|
||||
verts.push(
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight
|
||||
);
|
||||
if (dot >= 0) {
|
||||
if (style.join === "round") {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 4;
|
||||
} else {
|
||||
indexCount += 2;
|
||||
}
|
||||
verts.push(
|
||||
x1 - perp1x * outerWeight,
|
||||
y1 - perp1y * outerWeight
|
||||
);
|
||||
verts.push(
|
||||
x1 + perp1x * innerWeight,
|
||||
y1 + perp1y * innerWeight
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const c1 = (-perpX + x0) * (-perpY + y1) - (-perpX + x1) * (-perpY + y0);
|
||||
const c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);
|
||||
const px = (dx0 * c2 - dx1 * c1) / cross;
|
||||
const py = (dy1 * c1 - dy0 * c2) / cross;
|
||||
const pDist = (px - x1) * (px - x1) + (py - y1) * (py - y1);
|
||||
const imx = x1 + (px - x1) * innerWeight;
|
||||
const imy = y1 + (py - y1) * innerWeight;
|
||||
const omx = x1 - (px - x1) * outerWeight;
|
||||
const omy = y1 - (py - y1) * outerWeight;
|
||||
const smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);
|
||||
const insideWeight = clockwise ? innerWeight : outerWeight;
|
||||
const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
|
||||
const insideMiterOk = pDist <= smallerInsideDiagonalSq;
|
||||
if (insideMiterOk) {
|
||||
if (style.join === "bevel" || pDist / widthSquared > miterLimitSquared) {
|
||||
if (clockwise) {
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
indexCount += 2;
|
||||
} else if (style.join === "round") {
|
||||
if (clockwise) {
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
x1 + perp1x * outerWeight,
|
||||
y1 + perp1y * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 4;
|
||||
verts.push(imx, imy);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 4;
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
} else {
|
||||
verts.push(imx, imy);
|
||||
verts.push(omx, omy);
|
||||
}
|
||||
} else {
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
if (style.join === "round") {
|
||||
if (clockwise) {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
x1 + perp1x * outerWeight,
|
||||
y1 + perp1y * outerWeight,
|
||||
verts,
|
||||
true
|
||||
) + 2;
|
||||
} else {
|
||||
indexCount += round(
|
||||
x1,
|
||||
y1,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 - perp1x * innerWeight,
|
||||
y1 - perp1y * innerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 2;
|
||||
}
|
||||
} else if (style.join === "miter" && pDist / widthSquared <= miterLimitSquared) {
|
||||
if (clockwise) {
|
||||
verts.push(omx, omy);
|
||||
verts.push(omx, omy);
|
||||
} else {
|
||||
verts.push(imx, imy);
|
||||
verts.push(imx, imy);
|
||||
}
|
||||
indexCount += 2;
|
||||
}
|
||||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
||||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
||||
indexCount += 2;
|
||||
}
|
||||
}
|
||||
x0 = points[(length - 2) * 2];
|
||||
y0 = points[(length - 2) * 2 + 1];
|
||||
x1 = points[(length - 1) * 2];
|
||||
y1 = points[(length - 1) * 2 + 1];
|
||||
perpX = -(y0 - y1);
|
||||
perpY = x0 - x1;
|
||||
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
perpX /= dist;
|
||||
perpY /= dist;
|
||||
perpX *= width;
|
||||
perpY *= width;
|
||||
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
||||
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
||||
if (!closedShape) {
|
||||
if (style.cap === "round") {
|
||||
indexCount += round(
|
||||
x1 - perpX * (innerWeight - outerWeight) * 0.5,
|
||||
y1 - perpY * (innerWeight - outerWeight) * 0.5,
|
||||
x1 - perpX * innerWeight,
|
||||
y1 - perpY * innerWeight,
|
||||
x1 + perpX * outerWeight,
|
||||
y1 + perpY * outerWeight,
|
||||
verts,
|
||||
false
|
||||
) + 2;
|
||||
} else if (style.cap === "square") {
|
||||
indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);
|
||||
}
|
||||
}
|
||||
const eps2 = curveEps * curveEps;
|
||||
for (let i = indexStart; i < indexCount + indexStart - 2; ++i) {
|
||||
x0 = verts[i * 2];
|
||||
y0 = verts[i * 2 + 1];
|
||||
x1 = verts[(i + 1) * 2];
|
||||
y1 = verts[(i + 1) * 2 + 1];
|
||||
x2 = verts[(i + 2) * 2];
|
||||
y2 = verts[(i + 2) * 2 + 1];
|
||||
if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {
|
||||
continue;
|
||||
}
|
||||
indices.push(i, i + 1, i + 2);
|
||||
}
|
||||
}
|
||||
|
||||
export { buildLine };
|
||||
//# sourceMappingURL=buildLine.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { Polygon } from '../../../../maths/shapes/Polygon';
|
||||
import type { ShapeBuildCommand } from './ShapeBuildCommand';
|
||||
/**
|
||||
* Builds a rectangle to draw
|
||||
*
|
||||
* Ignored from docs since it is not directly exposed.
|
||||
* @ignore
|
||||
* @private
|
||||
*/
|
||||
export declare const buildPolygon: ShapeBuildCommand<Polygon>;
|
25
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.js
generated
vendored
Normal file
25
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
var triangulateWithHoles = require('../utils/triangulateWithHoles.js');
|
||||
|
||||
"use strict";
|
||||
const emptyArray = [];
|
||||
const buildPolygon = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.ShapeBuilder,
|
||||
name: "polygon"
|
||||
},
|
||||
build(shape, points) {
|
||||
for (let i = 0; i < shape.points.length; i++) {
|
||||
points[i] = shape.points[i];
|
||||
}
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
triangulateWithHoles.triangulateWithHoles(points, emptyArray, vertices, verticesStride, verticesOffset, indices, indicesOffset);
|
||||
}
|
||||
};
|
||||
|
||||
exports.buildPolygon = buildPolygon;
|
||||
//# sourceMappingURL=buildPolygon.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildPolygon.js","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildPolygon.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\nimport { triangulateWithHoles } from '../utils/triangulateWithHoles';\n\nimport type { Polygon } from '../../../../maths/shapes/Polygon';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\nconst emptyArray: number[] = [];\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildPolygon: ShapeBuildCommand<Polygon> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'polygon',\n },\n\n build(shape: Polygon, points: number[]): number[]\n {\n for (let i = 0; i < shape.points.length; i++)\n {\n points[i] = shape.points[i];\n }\n\n return points;\n },\n\n triangulate(\n points: number[],\n // holes: number[],\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n triangulateWithHoles(points, emptyArray, vertices, verticesStride, verticesOffset, indices, indicesOffset);\n },\n\n};\n"],"names":["ExtensionType","triangulateWithHoles"],"mappings":";;;;;;AAMA,MAAM,aAAuB,EAAC,CAAA;AASvB,MAAM,YAA2C,GAAA;AAAA,EACpD,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,SAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAgB,MACtB,EAAA;AACI,IAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,KAAM,CAAA,MAAA,CAAO,QAAQ,CACzC,EAAA,EAAA;AACI,MAAA,MAAA,CAAO,CAAC,CAAA,GAAI,KAAM,CAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAAA,KAC9B;AAEA,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAAC,yCAAA,CAAqB,QAAQ,UAAY,EAAA,QAAA,EAAU,cAAgB,EAAA,cAAA,EAAgB,SAAS,aAAa,CAAA,CAAA;AAAA,GAC7G;AAEJ;;;;"}
|
23
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.mjs
generated
vendored
Normal file
23
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.mjs
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
import { triangulateWithHoles } from '../utils/triangulateWithHoles.mjs';
|
||||
|
||||
"use strict";
|
||||
const emptyArray = [];
|
||||
const buildPolygon = {
|
||||
extension: {
|
||||
type: ExtensionType.ShapeBuilder,
|
||||
name: "polygon"
|
||||
},
|
||||
build(shape, points) {
|
||||
for (let i = 0; i < shape.points.length; i++) {
|
||||
points[i] = shape.points[i];
|
||||
}
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
triangulateWithHoles(points, emptyArray, vertices, verticesStride, verticesOffset, indices, indicesOffset);
|
||||
}
|
||||
};
|
||||
|
||||
export { buildPolygon };
|
||||
//# sourceMappingURL=buildPolygon.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildPolygon.mjs","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildPolygon.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\nimport { triangulateWithHoles } from '../utils/triangulateWithHoles';\n\nimport type { Polygon } from '../../../../maths/shapes/Polygon';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\nconst emptyArray: number[] = [];\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildPolygon: ShapeBuildCommand<Polygon> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'polygon',\n },\n\n build(shape: Polygon, points: number[]): number[]\n {\n for (let i = 0; i < shape.points.length; i++)\n {\n points[i] = shape.points[i];\n }\n\n return points;\n },\n\n triangulate(\n points: number[],\n // holes: number[],\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n triangulateWithHoles(points, emptyArray, vertices, verticesStride, verticesOffset, indices, indicesOffset);\n },\n\n};\n"],"names":[],"mappings":";;;;AAMA,MAAM,aAAuB,EAAC,CAAA;AASvB,MAAM,YAA2C,GAAA;AAAA,EACpD,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,SAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAgB,MACtB,EAAA;AACI,IAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,KAAM,CAAA,MAAA,CAAO,QAAQ,CACzC,EAAA,EAAA;AACI,MAAA,MAAA,CAAO,CAAC,CAAA,GAAI,KAAM,CAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAAA,KAC9B;AAEA,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAA,oBAAA,CAAqB,QAAQ,UAAY,EAAA,QAAA,EAAU,cAAgB,EAAA,cAAA,EAAgB,SAAS,aAAa,CAAA,CAAA;AAAA,GAC7G;AAEJ;;;;"}
|
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { Rectangle } from '../../../../maths/shapes/Rectangle';
|
||||
import type { ShapeBuildCommand } from './ShapeBuildCommand';
|
||||
/**
|
||||
* Builds a rectangle to draw
|
||||
*
|
||||
* Ignored from docs since it is not directly exposed.
|
||||
* @ignore
|
||||
* @private
|
||||
*/
|
||||
export declare const buildRectangle: ShapeBuildCommand<Rectangle>;
|
56
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.js
generated
vendored
Normal file
56
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
const buildRectangle = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.ShapeBuilder,
|
||||
name: "rectangle"
|
||||
},
|
||||
build(shape, points) {
|
||||
const rectData = shape;
|
||||
const x = rectData.x;
|
||||
const y = rectData.y;
|
||||
const width = rectData.width;
|
||||
const height = rectData.height;
|
||||
if (!(width >= 0 && height >= 0)) {
|
||||
return points;
|
||||
}
|
||||
points[0] = x;
|
||||
points[1] = y;
|
||||
points[2] = x + width;
|
||||
points[3] = y;
|
||||
points[4] = x + width;
|
||||
points[5] = y + height;
|
||||
points[6] = x;
|
||||
points[7] = y + height;
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
let count = 0;
|
||||
verticesOffset *= verticesStride;
|
||||
vertices[verticesOffset + count] = points[0];
|
||||
vertices[verticesOffset + count + 1] = points[1];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[2];
|
||||
vertices[verticesOffset + count + 1] = points[3];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[6];
|
||||
vertices[verticesOffset + count + 1] = points[7];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[4];
|
||||
vertices[verticesOffset + count + 1] = points[5];
|
||||
count += verticesStride;
|
||||
const verticesIndex = verticesOffset / verticesStride;
|
||||
indices[indicesOffset++] = verticesIndex;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 3;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
}
|
||||
};
|
||||
|
||||
exports.buildRectangle = buildRectangle;
|
||||
//# sourceMappingURL=buildRectangle.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildRectangle.js","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildRectangle.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\n\nimport type { Rectangle } from '../../../../maths/shapes/Rectangle';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildRectangle: ShapeBuildCommand<Rectangle> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'rectangle',\n },\n\n build(shape: Rectangle, points: number[]): number[]\n {\n const rectData = shape;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n if (!(width >= 0 && height >= 0))\n {\n return points;\n }\n\n points[0] = x;\n points[1] = y;\n points[2] = x + width;\n points[3] = y;\n points[4] = x + width;\n points[5] = y + height;\n points[6] = x;\n points[7] = y + height;\n\n return points;\n },\n\n triangulate(\n points: number[],\n\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n let count = 0;\n\n verticesOffset *= verticesStride;\n\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[6];\n vertices[verticesOffset + count + 1] = points[7];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n\n count += verticesStride;\n\n const verticesIndex = verticesOffset / verticesStride;\n\n // triangle 1\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n\n // triangle 2\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 3;\n indices[indicesOffset++] = verticesIndex + 2;\n },\n};\n"],"names":["ExtensionType"],"mappings":";;;;;AAYO,MAAM,cAA+C,GAAA;AAAA,EACxD,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,WAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAkB,MACxB,EAAA;AACI,IAAA,MAAM,QAAW,GAAA,KAAA,CAAA;AACjB,IAAA,MAAM,IAAI,QAAS,CAAA,CAAA,CAAA;AACnB,IAAA,MAAM,IAAI,QAAS,CAAA,CAAA,CAAA;AACnB,IAAA,MAAM,QAAQ,QAAS,CAAA,KAAA,CAAA;AACvB,IAAA,MAAM,SAAS,QAAS,CAAA,MAAA,CAAA;AAExB,IAAA,IAAI,EAAE,KAAA,IAAS,CAAK,IAAA,MAAA,IAAU,CAC9B,CAAA,EAAA;AACI,MAAO,OAAA,MAAA,CAAA;AAAA,KACX;AAEA,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,KAAA,CAAA;AAChB,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,KAAA,CAAA;AAChB,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,MAAA,CAAA;AAChB,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,MAAA,CAAA;AAEhB,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,IAAkB,cAAA,IAAA,cAAA,CAAA;AAElB,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,MAAM,gBAAgB,cAAiB,GAAA,cAAA,CAAA;AAGvC,IAAA,OAAA,CAAQ,eAAe,CAAI,GAAA,aAAA,CAAA;AAC3B,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAG3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAAA,GAC/C;AACJ;;;;"}
|
54
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.mjs
generated
vendored
Normal file
54
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
const buildRectangle = {
|
||||
extension: {
|
||||
type: ExtensionType.ShapeBuilder,
|
||||
name: "rectangle"
|
||||
},
|
||||
build(shape, points) {
|
||||
const rectData = shape;
|
||||
const x = rectData.x;
|
||||
const y = rectData.y;
|
||||
const width = rectData.width;
|
||||
const height = rectData.height;
|
||||
if (!(width >= 0 && height >= 0)) {
|
||||
return points;
|
||||
}
|
||||
points[0] = x;
|
||||
points[1] = y;
|
||||
points[2] = x + width;
|
||||
points[3] = y;
|
||||
points[4] = x + width;
|
||||
points[5] = y + height;
|
||||
points[6] = x;
|
||||
points[7] = y + height;
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
let count = 0;
|
||||
verticesOffset *= verticesStride;
|
||||
vertices[verticesOffset + count] = points[0];
|
||||
vertices[verticesOffset + count + 1] = points[1];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[2];
|
||||
vertices[verticesOffset + count + 1] = points[3];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[6];
|
||||
vertices[verticesOffset + count + 1] = points[7];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[4];
|
||||
vertices[verticesOffset + count + 1] = points[5];
|
||||
count += verticesStride;
|
||||
const verticesIndex = verticesOffset / verticesStride;
|
||||
indices[indicesOffset++] = verticesIndex;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 3;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
}
|
||||
};
|
||||
|
||||
export { buildRectangle };
|
||||
//# sourceMappingURL=buildRectangle.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildRectangle.mjs","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildRectangle.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\n\nimport type { Rectangle } from '../../../../maths/shapes/Rectangle';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildRectangle: ShapeBuildCommand<Rectangle> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'rectangle',\n },\n\n build(shape: Rectangle, points: number[]): number[]\n {\n const rectData = shape;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n if (!(width >= 0 && height >= 0))\n {\n return points;\n }\n\n points[0] = x;\n points[1] = y;\n points[2] = x + width;\n points[3] = y;\n points[4] = x + width;\n points[5] = y + height;\n points[6] = x;\n points[7] = y + height;\n\n return points;\n },\n\n triangulate(\n points: number[],\n\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n let count = 0;\n\n verticesOffset *= verticesStride;\n\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[6];\n vertices[verticesOffset + count + 1] = points[7];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n\n count += verticesStride;\n\n const verticesIndex = verticesOffset / verticesStride;\n\n // triangle 1\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n\n // triangle 2\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 3;\n indices[indicesOffset++] = verticesIndex + 2;\n },\n};\n"],"names":[],"mappings":";;;AAYO,MAAM,cAA+C,GAAA;AAAA,EACxD,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,WAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAkB,MACxB,EAAA;AACI,IAAA,MAAM,QAAW,GAAA,KAAA,CAAA;AACjB,IAAA,MAAM,IAAI,QAAS,CAAA,CAAA,CAAA;AACnB,IAAA,MAAM,IAAI,QAAS,CAAA,CAAA,CAAA;AACnB,IAAA,MAAM,QAAQ,QAAS,CAAA,KAAA,CAAA;AACvB,IAAA,MAAM,SAAS,QAAS,CAAA,MAAA,CAAA;AAExB,IAAA,IAAI,EAAE,KAAA,IAAS,CAAK,IAAA,MAAA,IAAU,CAC9B,CAAA,EAAA;AACI,MAAO,OAAA,MAAA,CAAA;AAAA,KACX;AAEA,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,KAAA,CAAA;AAChB,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,KAAA,CAAA;AAChB,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,MAAA,CAAA;AAChB,IAAA,MAAA,CAAO,CAAC,CAAI,GAAA,CAAA,CAAA;AACZ,IAAO,MAAA,CAAA,CAAC,IAAI,CAAI,GAAA,MAAA,CAAA;AAEhB,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,IAAkB,cAAA,IAAA,cAAA,CAAA;AAElB,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,MAAM,gBAAgB,cAAiB,GAAA,cAAA,CAAA;AAGvC,IAAA,OAAA,CAAQ,eAAe,CAAI,GAAA,aAAA,CAAA;AAC3B,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAG3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAAA,GAC/C;AACJ;;;;"}
|
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { Triangle } from '../../../../maths/shapes/Triangle';
|
||||
import type { ShapeBuildCommand } from './ShapeBuildCommand';
|
||||
/**
|
||||
* Builds a triangle to draw
|
||||
*
|
||||
* Ignored from docs since it is not directly exposed.
|
||||
* @ignore
|
||||
* @private
|
||||
*/
|
||||
export declare const buildTriangle: ShapeBuildCommand<Triangle>;
|
39
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.js
generated
vendored
Normal file
39
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
const buildTriangle = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.ShapeBuilder,
|
||||
name: "triangle"
|
||||
},
|
||||
build(shape, points) {
|
||||
points[0] = shape.x;
|
||||
points[1] = shape.y;
|
||||
points[2] = shape.x2;
|
||||
points[3] = shape.y2;
|
||||
points[4] = shape.x3;
|
||||
points[5] = shape.y3;
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
let count = 0;
|
||||
verticesOffset *= verticesStride;
|
||||
vertices[verticesOffset + count] = points[0];
|
||||
vertices[verticesOffset + count + 1] = points[1];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[2];
|
||||
vertices[verticesOffset + count + 1] = points[3];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[4];
|
||||
vertices[verticesOffset + count + 1] = points[5];
|
||||
const verticesIndex = verticesOffset / verticesStride;
|
||||
indices[indicesOffset++] = verticesIndex;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
}
|
||||
};
|
||||
|
||||
exports.buildTriangle = buildTriangle;
|
||||
//# sourceMappingURL=buildTriangle.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildTriangle.js","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildTriangle.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\n\nimport type { Triangle } from '../../../../maths/shapes/Triangle';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\n/**\n * Builds a triangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildTriangle: ShapeBuildCommand<Triangle> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'triangle',\n },\n\n build(shape: Triangle, points: number[]): number[]\n {\n points[0] = shape.x;\n points[1] = shape.y;\n points[2] = shape.x2;\n points[3] = shape.y2;\n points[4] = shape.x3;\n points[5] = shape.y3;\n\n return points;\n },\n\n triangulate(\n points: number[],\n\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n let count = 0;\n\n verticesOffset *= verticesStride;\n\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n\n const verticesIndex = verticesOffset / verticesStride;\n\n // triangle 1\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n },\n};\n"],"names":["ExtensionType"],"mappings":";;;;;AAYO,MAAM,aAA6C,GAAA;AAAA,EACtD,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,UAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAiB,MACvB,EAAA;AACI,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,CAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,CAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAElB,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,IAAkB,cAAA,IAAA,cAAA,CAAA;AAElB,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAA,MAAM,gBAAgB,cAAiB,GAAA,cAAA,CAAA;AAGvC,IAAA,OAAA,CAAQ,eAAe,CAAI,GAAA,aAAA,CAAA;AAC3B,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAAA,GAC/C;AACJ;;;;"}
|
37
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.mjs
generated
vendored
Normal file
37
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.mjs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
const buildTriangle = {
|
||||
extension: {
|
||||
type: ExtensionType.ShapeBuilder,
|
||||
name: "triangle"
|
||||
},
|
||||
build(shape, points) {
|
||||
points[0] = shape.x;
|
||||
points[1] = shape.y;
|
||||
points[2] = shape.x2;
|
||||
points[3] = shape.y2;
|
||||
points[4] = shape.x3;
|
||||
points[5] = shape.y3;
|
||||
return points;
|
||||
},
|
||||
triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
let count = 0;
|
||||
verticesOffset *= verticesStride;
|
||||
vertices[verticesOffset + count] = points[0];
|
||||
vertices[verticesOffset + count + 1] = points[1];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[2];
|
||||
vertices[verticesOffset + count + 1] = points[3];
|
||||
count += verticesStride;
|
||||
vertices[verticesOffset + count] = points[4];
|
||||
vertices[verticesOffset + count + 1] = points[5];
|
||||
const verticesIndex = verticesOffset / verticesStride;
|
||||
indices[indicesOffset++] = verticesIndex;
|
||||
indices[indicesOffset++] = verticesIndex + 1;
|
||||
indices[indicesOffset++] = verticesIndex + 2;
|
||||
}
|
||||
};
|
||||
|
||||
export { buildTriangle };
|
||||
//# sourceMappingURL=buildTriangle.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildTriangle.mjs","sources":["../../../../../src/scene/graphics/shared/buildCommands/buildTriangle.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\n\nimport type { Triangle } from '../../../../maths/shapes/Triangle';\nimport type { ShapeBuildCommand } from './ShapeBuildCommand';\n\n/**\n * Builds a triangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n */\nexport const buildTriangle: ShapeBuildCommand<Triangle> = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: 'triangle',\n },\n\n build(shape: Triangle, points: number[]): number[]\n {\n points[0] = shape.x;\n points[1] = shape.y;\n points[2] = shape.x2;\n points[3] = shape.y2;\n points[4] = shape.x3;\n points[5] = shape.y3;\n\n return points;\n },\n\n triangulate(\n points: number[],\n\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n )\n {\n let count = 0;\n\n verticesOffset *= verticesStride;\n\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n\n count += verticesStride;\n\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n\n const verticesIndex = verticesOffset / verticesStride;\n\n // triangle 1\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n },\n};\n"],"names":[],"mappings":";;;AAYO,MAAM,aAA6C,GAAA;AAAA,EACtD,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,YAAA;AAAA,IACpB,IAAM,EAAA,UAAA;AAAA,GACV;AAAA,EAEA,KAAA,CAAM,OAAiB,MACvB,EAAA;AACI,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,CAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,CAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAClB,IAAO,MAAA,CAAA,CAAC,IAAI,KAAM,CAAA,EAAA,CAAA;AAElB,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAAA,EAEA,YACI,MAEA,EAAA,QAAA,EACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,IAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,IAAkB,cAAA,IAAA,cAAA,CAAA;AAElB,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAS,KAAA,IAAA,cAAA,CAAA;AAET,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC3C,IAAA,QAAA,CAAS,cAAiB,GAAA,KAAA,GAAQ,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA,CAAA;AAE/C,IAAA,MAAM,gBAAgB,cAAiB,GAAA,cAAA,CAAA;AAGvC,IAAA,OAAA,CAAQ,eAAe,CAAI,GAAA,aAAA,CAAA;AAC3B,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAC3C,IAAQ,OAAA,CAAA,aAAA,EAAe,IAAI,aAAgB,GAAA,CAAA,CAAA;AAAA,GAC/C;AACJ;;;;"}
|
Reference in New Issue
Block a user