-
-
Notifications
You must be signed in to change notification settings - Fork 831
/
Range.ts
38 lines (34 loc) · 1.01 KB
/
Range.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { ICoordinates } from "../Interfaces/ICoordinates";
/**
* @category Utils
*/
export abstract class Range {
/**
* Range position
*/
readonly position: ICoordinates;
/**
* Range constructor, initializes the position
* @param x X coordinate of the position
* @param y Y coordinate of the position
* @protected
*/
protected constructor(x: number, y: number) {
this.position = {
x: x,
y: y,
};
}
/**
* Check if the point is inside the range
* @param point the point to check in the range
* @returns true or false, checking if the given point is inside the current range
*/
abstract contains(point: ICoordinates): boolean;
/**
* Check if another range intersects with the current one
* @param range the range to check the intersection with
* @returns true or false, checking if the range is intersecting with the current range
*/
abstract intersects(range: Range): boolean;
}