UNPKG

1 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.PolygonDrawer = void 0;
4const PolygonDrawerBase_1 = require("./PolygonDrawerBase");
5class PolygonDrawer extends PolygonDrawerBase_1.PolygonDrawerBase {
6 getSidesData(particle, radius) {
7 var _a, _b;
8 const polygon = particle.shapeData;
9 const sides = (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
10 return {
11 count: {
12 denominator: 1,
13 numerator: sides,
14 },
15 length: (radius * 2.66) / (sides / 3),
16 };
17 }
18 getCenter(particle, radius) {
19 const sides = this.getSidesCount(particle);
20 return {
21 x: -radius / (sides / 3.5),
22 y: -radius / (2.66 / 3.5),
23 };
24 }
25}
26exports.PolygonDrawer = PolygonDrawer;