Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function polygonPoints(n: number, k: number) {
const dots = [{x: 0, y: 0, m: 0}];
for (let m = 1; m < k; ++m) { // Loop over each iteration.
// Generate the vertices of the polygon (except the first).
const vertices = list(1, n - 1).map(i => polygonVertex(n, i, m));
dots.push(...vertices);
// Generate the in-between points along each edge.
for (let a = 0; a < n - 2; ++a) {
for (let x = 1; x < m; ++x) {
const p = Point.interpolate(vertices[a], vertices[a + 1], x / m);
dots.push({x: p.x, y: p.y, m});
}
}
}
return dots;
}
($v, i) => { $v.setCenter(Point.interpolate(start[i], end[i], x)); });
$edges.forEach(($e, i) => {
$edges.forEach(($e, i) => {
$e.setLine(Point.interpolate(start[i], end[i], x),
Point.interpolate(start[(i + 1) % 4], end[(i + 1) % 4], x));
});
}, 400);
$edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
Point.interpolate(start[(i+1)%4], end[(i+1)%4], x)); });
}, 400);
$edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
Point.interpolate(start[(i+1)%4], end[(i+1)%4], x)); });
}, 400);
$vertices.forEach(($v, i) => { $v.setCenter(Point.interpolate(start[i], end[i], x)); });
$edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
$edges.forEach(($e, i) => {
$e.setLine(Point.interpolate(start[i], end[i], x),
Point.interpolate(start[(i + 1) % 4], end[(i + 1) % 4], x));
});
}, 400);