UNPKG

@hiddentao/clockwork-engine

Version:

A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering

42 lines 1.73 kB
import { Vector2D } from "./Vector2D"; /** * Vector math and geometry utilities */ export declare class Geometry { /** * Check if a line segment intersects a rectangle */ static lineIntersectsRectangle(lineStart: Vector2D, lineEnd: Vector2D, rectCenter: Vector2D, rectSize: Vector2D): boolean; /** * Check if two line segments intersect */ static lineIntersectsLine(a1: Vector2D, a2: Vector2D, b1: Vector2D, b2: Vector2D): boolean; /** * Smooth direction changes to prevent oscillation */ static smoothDirection(currentDirection: number, targetDirection: number, factor: number): number; /** * Blend between two angles based on a factor (0-1) * @param angle1 First angle in radians * @param angle2 Second angle in radians * @param factor Blend factor (0 = all angle1, 1 = all angle2) */ static blendAngles(angle1: number, angle2: number, factor: number): number; /** * Check if two rectangular objects overlap */ static objectsOverlap(pos1: Vector2D, size1: Vector2D, pos2: Vector2D, size2: Vector2D): boolean; /** * Calculate a future position based on current position, direction and distance */ static calculateFuturePosition(currentPosition: Vector2D, direction: number, distance: number): Vector2D; /** * Determine the closest edge of a rectangle to a point * @param position Point position * @param rectCenter Rectangle center position * @param rectSize Rectangle size * @returns 'left', 'right', 'top', or 'bottom' */ static determineClosestEdge(position: Vector2D, rectCenter: Vector2D, rectSize: Vector2D): string; } //# sourceMappingURL=GeometryUtils.d.ts.map