Files
pihkaal-me/app/utils/math.ts
2025-11-17 23:13:40 +01:00

9 lines
319 B
TypeScript

export type Point = [x: number, y: number];
export type Rect = [x: number, y: number, width: number, height: number];
export function rectContains(rect: Rect, point: Point): boolean {
const [x, y, width, height] = rect;
const [px, py] = point;
return px >= x && px <= x + width && py >= y && py <= y + height;
}