@turbox3d/math
Version:
Large-scale graphics application math library
33 lines (32 loc) • 1.19 kB
TypeScript
import { Vector2 } from './Vector2';
declare class Box2 {
min: Vector2;
max: Vector2;
readonly isBox2: boolean;
constructor(min?: Vector2, max?: Vector2);
set(min: Vector2, max: Vector2): this;
setFromPoints(points: Vector2[]): this;
setFromCenterAndSize(center: Vector2, size: Vector2): this;
clone(): Box2;
copy(box: Box2): this;
makeEmpty(): this;
isEmpty(): boolean;
equals(box: Box2, distTol?: number): boolean;
getCenter(target: Vector2): Vector2;
getSize(target: Vector2): Vector2;
expandByPoint(point: Vector2): this;
expandByVector(vector: Vector2): this;
expandByScalar(scalar: number): this;
containsPoint(point: Vector2, distTol?: number): boolean;
containsBox(box: Box2, distTol?: number): boolean;
isValid(): boolean;
isOverlapping(box: Box2, distTol?: number): boolean;
getParameter(point: Vector2, target: Vector2): Vector2;
intersectsBox(box: Box2): boolean;
clampPoint(point: Vector2, target: Vector2): Vector2;
distanceToPoint(point: Vector2): number;
intersect(box: Box2): this;
union(box: Box2): this;
translate(offset: Vector2): this;
}
export { Box2 };