import { Rectangle, Transform } from "../models"; export const degToRad = (deg: number) => (deg * Math.PI) / 180; export const radToDeg = (radians: number) => radians * (180 / Math.PI); export const getBounds = (rectangle: Rectangle, transform: Transform) => { const { top, left, bottom, right } = rectangle; const matrix2d = transform.toMatrix2D(); const topLeft = matrix2d.transformPoint({ x: left, y: top }); const bottomRight = matrix2d.transformPoint({ x: right, y: bottom }); return Rectangle.fromPoints(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); };