js-quadtree
Version:
A simple quadtree implementation for javascript (nodejs or browser with module bundler).
36 lines • 1.28 kB
TypeScript
/**
* Box class.
* @class Box
*/
import { Point } from "./Point";
import { Shape, UserCustomData } from "./types";
export declare class Box implements Shape {
readonly x: number;
readonly y: number;
readonly w: number;
readonly h: number;
readonly data: UserCustomData;
/**
* Box constructor;
* @constructs Box
* @param {number} x - X coordinate of the box.
* @param {number} y - Y coordinate of the box.
* @param {number} w - Width of the box.
* @param {number} h - Height of the box.
* @param {*} [data] - Data to store along the box.
*/
constructor(x: number, y: number, w: number, h: number, data?: UserCustomData);
/**
* Check if a point is contained in the box.
* @param {Point|Object} point - The point to test if it is contained in the box.
* @returns {boolean} - True if the point is contained in the box, otherwise false.
*/
contains(point: Point): boolean;
/**
* Check if a box intersects with this box.
* @param {Box|Object} range - The box to test the intersection with.
* @returns {boolean} - True if it intersects, otherwise false.
*/
intersects(range: Box): boolean;
}
//# sourceMappingURL=Box.d.ts.map