task(E2): arc-row tool for curved seating around stage

This commit is contained in:
Agent Zero
2026-08-27 22:49:09 +02:00
parent 85105d3f01
commit 633cf3d647
2 changed files with 97 additions and 1 deletions
+41
View File
@@ -280,6 +280,47 @@ export class SeatingService {
return elements;
}
/** Create an arc row (curved seating around a center point) — Task E2 */
createArcRow(
centerX: number,
centerY: number,
radius: number,
startAngleDeg: number,
endAngleDeg: number,
layerId: string,
spacing = 50,
): CADElement[] {
const arcLen = Math.abs(endAngleDeg - startAngleDeg) * Math.PI / 180 * radius;
const count = Math.max(2, Math.floor(arcLen / spacing));
const rowId = `arcrow_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
const elements: CADElement[] = [];
for (let i = 0; i <= count; i++) {
const angle = startAngleDeg + (endAngleDeg - startAngleDeg) * (i / count);
const rad = angle * Math.PI / 180;
const px = centerX + radius * Math.cos(rad);
const py = centerY + radius * Math.sin(rad);
elements.push({
id: this.generateId(),
type: 'chair',
layerId,
x: px,
y: py,
width: 45,
height: 45,
properties: {
rotation: angle + 90,
fill: '#4a90d9',
backrestColor: '#3a7ac9',
outlineColor: '#2a5a99',
seatType: 'standard',
rowIndex: i,
rowId,
},
});
}
return elements;
}
/** Create a table element */
createTable(x: number, y: number, layerId: string, config: Partial<TableConfig> = {}): CADElement {
const cfg = { ...DEFAULT_TABLE, ...config };