summaryrefslogtreecommitdiffstats
path: root/src/renderer/math/circle.ts
blob: f4e855a97257832702bd5969332ea774ea14325d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Collidable } from './collision';
import { Movement } from './line';
import { Point } from './point';

import { vec2 } from 'gl-matrix';

export class Circle implements Collidable, Point {
	private pointCollide = Point.prototype.collide;

	constructor(public readonly p: vec2, public readonly r: number) {}

	public collide(out: vec2, move: Movement, r: number): boolean {
		return this.pointCollide(out, move, r + this.r);
	}
}