From 3c51a1994f41b625823c4f15e92396b5498ce23c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Dec 2019 13:53:16 +0100 Subject: Move renderer into "runtime" subdirectory --- src/renderer/runtime/math/circle.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/renderer/runtime/math/circle.ts (limited to 'src/renderer/runtime/math/circle.ts') diff --git a/src/renderer/runtime/math/circle.ts b/src/renderer/runtime/math/circle.ts new file mode 100644 index 0000000..f4e855a --- /dev/null +++ b/src/renderer/runtime/math/circle.ts @@ -0,0 +1,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); + } +} -- cgit v1.2.3