UNPKG

810 BPlain TextView Raw
1/**
2 * All shape classes must implement this interface.
3 */
4export interface Indexable {
5 /**
6 * This method is called on all objects that are inserted into or retrieved from the Quadtree.
7 * It must determine which quadrant an object belongs to.
8 * @param node - Quadtree node to be checked
9 * @returns Array containing indexes of intersecting subnodes (0-3 = top-right, top-left, bottom-left, bottom-right)
10 */
11 qtIndex(node: NodeGeometry): number[]
12}
13
14/**
15 * Interface for geometry of a Quadtree node
16 */
17export interface NodeGeometry {
18 /**
19 * X position of the node
20 */
21 x: number
22
23 /**
24 * Y position of the node
25 */
26 y: number
27
28 /**
29 * Width of the node
30 */
31 width: number
32
33 /**
34 * Height of the node
35 */
36 height: number
37}
\No newline at end of file