fqtree
Version:
a flexible quadtree for JavaScript/TypeScript
128 lines • 3.44 kB
TypeScript
import { PointLike } from 'evjkit';
export declare interface IRange {
x: number;
y: number;
w: number;
h: number;
get left(): number;
get right(): number;
get top(): number;
get bottom(): number;
containsPoint(point: PointLike): boolean;
intersects(range: IRange): boolean;
}
export declare type RectBounds = {
x: number;
y: number;
w: number;
h: number;
};
export declare type CircleBounds = {
x: number;
y: number;
w: number;
h: number;
r: number;
};
export declare type LineBounds = {
x: number;
y: number;
w: number;
h: number;
from: PointLike;
to: PointLike;
};
export declare class RectangleRange {
x: number;
y: number;
w: number;
h: number;
/**
* Represents a Rectangular Range.
* @param x - x-coordinate of rectangle's center.
* @param y - y-coordinate of rectangle's center.
* @param w - half-width of the rectangle.
* @param h - half-height of the rectangle.
*/
constructor(x: number, y: number, w: number, h: number);
get left(): number;
get right(): number;
get top(): number;
get bottom(): number;
get bounds(): RectBounds;
/**
* tests if a point is within this range.
* @param point - point to test.
* @returns true if within, false if without.
*/
containsPoint(point: PointLike): boolean;
/**
* tests if a range is within this range.
* @param range - range to test.
* @returns true if within, false if without.
*/
containsRange(range: IRange): boolean;
/**
* tests if a shape is within or partially within this range.
* @param bounds - bounds to test.
* @returns true if intersection exists, otherwise false.
*/
intersects(bounds: IRange): boolean;
}
export declare class CircleRange {
x: number;
y: number;
r: number;
w: number;
h: number;
/**
* radius squared
*/
r2: number;
/**
* represents a circular area range.
* @param x - x-coordiante of circle center.
* @param y - y-coordinate of circle center
* @param r - radius of circle.
*/
constructor(x: number, y: number, r: number);
get left(): number;
get right(): number;
get top(): number;
get bottom(): number;
get bounds(): CircleBounds;
/**
* tests if a point is within this range.
* @param point - point to test.
* @returns true if within, false if without.
*/
containsPoint(point: PointLike): boolean;
/**
* tests if a shape is within or partially within this range.
* @param bounds - bounds to test.
* @returns true if intersection exists, otherwise false.
*/
intersects(bounds: IRange): boolean;
}
export declare class LineRange {
from: PointLike;
to: PointLike;
/**
* represents a line area range.
* @param from - starting point of line
* @param to - ending point of line
*/
constructor(from: PointLike, to: PointLike);
get left(): number;
get right(): number;
get top(): number;
get bottom(): number;
get bounds(): LineBounds;
/**
* tests if a shape is within or partially within this range.
* @param bounds - bounds to test.
* @returns true if intersection exists, otherwise false.
*/
intersects(bounds: IRange): boolean;
}
//# sourceMappingURL=range.d.ts.map