UNPKG

@phaserjs/phaser

Version:
12 lines (11 loc) 424 B
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ export function GetEllipseCircumference(ellipse) { const rx = ellipse.width / 2; const ry = ellipse.height / 2; const h = Math.pow(rx - ry, 2) / Math.pow(rx + ry, 2); return Math.PI * (rx + ry) * (1 + 3 * h / (10 + Math.sqrt(4 - 3 * h))); }