Files
Aislo/B07_wf4_DesignDetail/openwebcad/src/tools/rotate-tool.helpers.ts
T
2026-07-19 17:01:48 +09:00

23 lines
586 B
TypeScript

import {Line, type Point} from '@flatten-js/core';
import type {Entity} from '../entities/Entity';
/**
* Rotate entities round a base point by a certain angle
* @param entities
* @param rotateOrigin
* @param startAnglePoint
* @param endAnglePoint
*/
export function rotateEntities(
entities: Entity[],
rotateOrigin: Point,
startAnglePoint: Point,
endAnglePoint: Point
) {
const rotationAngle =
new Line(rotateOrigin, endAnglePoint).slope - new Line(rotateOrigin, startAnglePoint).slope;
for (const entity of entities) {
entity.rotate(rotateOrigin, rotationAngle);
}
}