import { addVector } from "../vector/add-vector.js"; import { distanceBetween } from "../vector/distance-between.js"; import { subtractVector } from "../vector/subtract-vector.js"; import { Shape } from "./shape.js"; import { getCentroid } from "./get-centroid.js"; import { ShapeType } from "../types/shape-type.js"; const { PI, cos, sin, atan2, round } = Math; function fromLineSegment( sides: ShapeType, ls: number[][], stagePlacement: number): Shape { const [v1,v2] = ls; const l = distanceBetween(v1,v2); const v = subtractVector(v2,v1); let θ = atan2(v[1],v[0]) + (2*PI)/sides; const ps = [v1,v2]; for (let i=2; i