{"version":3,"file":"drawRegularPolygon.mjs","sources":["../src/drawRegularPolygon.ts"],"sourcesContent":["import type { Graphics } from '@pixi/graphics';\n\n/**\n * Draw a regular polygon where all sides are the same length.\n *\n * _Note: Only available with **@pixi/graphics-extras**._\n * @method PIXI.Graphics#drawRegularPolygon\n * @param this\n * @param {number} x - X position\n * @param {number} y - Y position\n * @param {number} radius - Polygon radius\n * @param {number} sides - Minimum value is 3\n * @param {number} rotation - Starting rotation values in radians..\n * @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nexport function drawRegularPolygon(this: Graphics,\n    x: number,\n    y: number,\n    radius: number,\n    sides: number,\n    rotation = 0): Graphics\n{\n    sides = Math.max(sides | 0, 3);\n    const startAngle = (-1 * Math.PI / 2) + rotation;\n    const delta = (Math.PI * 2) / sides;\n    const polygon = [];\n\n    for (let i = 0; i < sides; i++)\n    {\n        const angle = (i * delta) + startAngle;\n\n        polygon.push(\n            x + (radius * Math.cos(angle)),\n            y + (radius * Math.sin(angle))\n        );\n    }\n\n    return this.drawPolygon(polygon);\n}\n"],"names":[],"mappings":"AAeO,SAAS,mBACZ,GACA,GACA,QACA,OACA,WAAW,GACf;AACI,UAAQ,KAAK,IAAI,QAAQ,GAAG,CAAC;AAC7B,QAAM,aAAc,KAAK,KAAK,KAAK,IAAK,UAClC,QAAS,KAAK,KAAK,IAAK,OACxB,UAAU,CAAA;AAEhB,WAAS,IAAI,GAAG,IAAI,OAAO,KAC3B;AACU,UAAA,QAAS,IAAI,QAAS;AAEpB,YAAA;AAAA,MACJ,IAAK,SAAS,KAAK,IAAI,KAAK;AAAA,MAC5B,IAAK,SAAS,KAAK,IAAI,KAAK;AAAA,IAAA;AAAA,EAEpC;AAEO,SAAA,KAAK,YAAY,OAAO;AACnC;"}