Release package version 0.0.3
All checks were successful
CI / build (push) Successful in 29s

Added Matrix2d class, update Transform class
This commit is contained in:
Andrey Kernichniy 2026-03-15 00:14:45 +07:00
parent e5f5f3a08e
commit 4dbba31ed5
7 changed files with 159 additions and 1 deletions

View file

@ -1 +1,15 @@
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);
};