Files
nothoughts/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs
2025-08-04 18:57:35 +02:00

26 lines
717 B
JavaScript

"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